Original Post
Ok, I have a problem. I don''t know much about how to change from 8 bit indexed color to 16+ RGB values, so I''m calling upon all of you. here is what I have so far from Andre''s code
how do I change the function so that it takes in an RGB(...) (colorref right?) and display it based on what i send it. I bet that was pretty dang confusing.
Someone give me a pointer to the right direction.
int Draw_Rectangle(int x1, int y1, int x2, int y2, int color,
LPDIRECTDRAWSURFACE lpdds)
{
// this function uses directdraw to draw a filled rectangle
DDBLTFX ddbltfx; // this contains the DDBLTFX structure
RECT fill_area; // this contains the destination rectangle
Set_Palette(bitmap8bit.palette);
// clear out the structure and set the size field
DD_INIT_STRUCT(ddbltfx);
// set the dwfillcolor field to the desired color
ddbltfx.dwFillColor = color;
// fill in the destination rectangle data (your data)
fill_area.top = y1;
fill_area.left = x1;
fill_area.bottom = y2;
fill_area.right = x2;
// ready to blt to surface, in this case blt to primary
lpdds->Blt(&fill_area, // ptr to dest rectangle
NULL, // ptr to source surface, NA
NULL, // ptr to source rectangle, NA
DDBLT_COLORFILL / DDBLT_WAIT, // fill and wait
&ddbltfx); // ptr to DDBLTFX structure
// return success
return(1);
} // end Draw_Rectangle
|