Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Nullio

Color Key Error

This topic is 6073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

  
#define _RGB16BIT565(r,g,b) ((b%32) + ((g%64) << 6) + ((r%32) << 11))

color_key.dwColorSpaceLowValue = _RGB16BIT565(0,0,254)
color_key.dwColorSpaceHighValue = _RGB16BIT565(0,0,254)

lpddSurface->SetColorKey(DDCKEY_SRCBLT, &color_key)
  
this should set the color key of lpddSurface to Blue (well almost blue) right??? it don''t work, but when I set the LowValue and HighValue to 0 and adjust my images background color to black it works?? why is this???? _RGB16BIT565(0,0,254) would be the same color value as paint shops Red - 0 Green - 0 Blue - 254 right?

Share this post


Link to post
Share on other sites
Advertisement
254 % 32 = 30..

Depending on your bitmap loader you could get a different result (31 would get you closer to 254 than 30 would). I think the problem lies in your macro. The % is modulo. Closer to what you want (but not quite) is :

#define _RGB16BIT565(r,g,b) ((b) / 8 + (((g) / 4) << 6) + (((r) / 8) << 11))

That way, the colourkey should give you 248, rather than 240.

-Morten-

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!