Archived

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

C# DirectDraw ColorKey

This topic is 5046 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

When i set the colorkey for a surface, and draw it using DrawFlags.Wait and DrawFlags.KeySource, the area on the surface where the colorkey was becomes distorted and filled with random pixels...can anyone help? ..create surface.. ColorKey key = new ColorKey(); key.ColorSpaceLowValue = bmp.GetPixel(0, 0).ToArgb(); key.ColorSpaceHighValue = bmp.GetPixel(0, 0).ToArgb(); m_sfBmp.SetColorKey(ColorKeyFlags.SourceDraw, key); ...draw surface.. sfDest.Draw(m_sfBmp, DrawFlags.KeySource | DrawFlags.Wait);

Share this post


Link to post
Share on other sites
Does this problem still exist if you choose black or white as the color key color?

From what I remember with the native DDraw API, the color key value must be specified in the appropriate surface format, even though you''re setting a DWORD. Since black (0) is the the same value in any RGB surface format, it would be interesting to find out if that color works in your situation. That would tell me that the color value you need to set must take into account the surface format and bpp.

Share this post


Link to post
Share on other sites