PDA

View Full Version : TColor and dxDraw1.Surface.Fill



atozix
08-12-2003, 07:05 PM
Hi ho again guys :)

Whats the story regarding dxdraw and color allocation??

If I use a standard TColor value in the form of say
var back_col: TColor;

back_col := $00XXXXXX; // ( some desired color)
dxDraw1.Surface.Fill(back_col);

then it does not display the correct color

I have tried setting the high order byte to the various values allowed such as 00 or 01 or 02 ...

am using a 800 X 600 screen and have tried the different color resolutions like 16 and 24

anyway the desired action is to be able to set the background to a particular desired color.... How ??

cheeeeeeeeeeerrrrrrrrrssssssssssss ato

Useless Hacker
08-12-2003, 08:02 PM
Hola!

You need to use the DXDraw.Surface.ColorMatch function to convert the TColor value to the value used by DirectDraw.
DXDraw.Surface.Fill(DXDraw.Surface.ColorMatch(back _col));
However, the ColorMatch method is quite slow IIRC, so you might find it better to do the conversion only once and store it until required.

atozix
09-12-2003, 07:15 PM
Yo ho ho Useless Hacker,,,

THX :) that werks well...

cheeeeeeeeerrrrrrrssssssssss ato