|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
A color key is described in a DDCOLORKEYstructure. If the color key is a single color, both members of this structure should be assigned the same value. Otherwise the color key is a range of colors.
Color keys are specified using the pixel format of a surface. If a surface is in a palettized format, the color key is given as an index or a range of indices. If the surface's pixel format is specified by a FOURCC code that describes a YUV format, the YUV color key is specified by the three low-order bytes in both the dwColorSpaceLowValueand dwColorSpaceHighValuemembers of the DDCOLORKEYstructure. The lowest order byte contains the V data, the second lowest order byte contains the U data, and the highest order byte contains the Y data.
Some examples of valid color keys follow:
8-bit palettized mode
// Palette entry 26 is the color key. dwColorSpaceLowValue = 26; dwColorSpaceHighValue = 26;
24-bit true-color mode
// Color 255,128,128 is the color key. dwColorSpaceLowValue = RGBQUAD(255,128,128); dwColorSpaceHighValue = RGBQUAD(255,128,128);
FourCC YUV mode
// Any YUV color where Y is between 100 and 110 // and U or V is between 50 and 55 is transparent. dwColorSpaceLowValue = YUVQUAD(100,50,50); dwColorSpaceHighValue = YUVQUAD(110,55,55);
Support for a range of colors rather than a single color is hardware-dependent. Check the dwCKeyCapsmember of the DDCAPSstructure for the hardware. The HEL does not support color ranges.
Some hardware supports color ranges only for YUV pixel data, which is usually video. The transparent background in video footage (the "blue screen" against which the subject was photographed) might not be a single pure color, so a range of colors in the color key is desirable.
Last updated on Tuesday, May 18, 2004