C# DirectDraw ColorKey

Started by
1 comment, last by shrtysk8r1 20 years, 2 months ago
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);
Advertisement
another thing..this only happens in 32 bit mode, and when i set the display to 16 bits the colorkey color draws just as if there were no colorkey..
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.

This topic is closed to new replies.

Advertisement