Link to home
Start Free TrialLog in
Avatar of dwatling
dwatling

asked on

DirectDraw SetColorKey problems

I recently modified my application to run at 640x480x16. Before, when it was using 8-bit graphics, transparency worked fine. However, now it does not, unless I use 0 as my source color key. Can someone provide some source or at least tell me what the heck is going on? Here's the code I use to change the color key:

bool DirectDrawSurface::SetColorKey(COLORREF color)
{
      DDCOLORKEY colorKey;

      colorKey.dwColorSpaceLowValue=color;
      colorKey.dwColorSpaceHighValue=colorKey.dwColorSpaceLowValue;
      if (Surface->SetColorKey(DDCKEY_SRCBLT,&colorKey)==DD_OK)
            return true;
      else return false;
}
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dwatling
dwatling

ASKER

Hmmn.. Seems to work only with pure black and pure white, not any color in between (eg. Hot pink). Oh well. Good enough. Thanks for your help.
Are you sure you specified a correct RGB value?
I defined it as "RGB(255,0,192)". The only thing that I can think of is under 16-bit mode, this color doesn't exist, but a close match does and for some reason or another DDColorMatch doesn't get it.
You can use some graphics utilities to view its color palette and get the exact RGB values.
I shall try that. Thanks.