Platform SDK: DirectX |
A color key is described in a DDCOLORKEY structure. 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 is in a non-palattized display mode, the color keys are specified in the raw pixel format. For instance, to set a bright purple color key in 16-bit 5:6:5 mode, you would use a value of 0xf81F (All 5 red bits are set, and all 5 blue bits are set).
Some examples of valid color keys follow:
8-bit palettized mode
// Palette entry 26 is the color key. dwColorSpaceLowValue = 26; dwColorSpaceHighValue = 26;
16-bit color mode
// Color is bright purple dwColorSpaceLowValue = 0xf81F; dwColorSpaceHighValue = 0xf81F;
Support for a range of colors rather than a single color is hardware-dependent. Check the dwCKeyCaps member of the DDCAPS structure for the hardware. The HEL does not support color ranges.
A color key is described in a DDCOLORKEY type. 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 is in a non-palattized display mode, the color keys are specified in the raw pixel format. For instance, to set a red color key in 24-bit true color mode, you would use a value of &HFF (All 5 red bits are set).
Some examples of valid color keys follow:
8-bit palettized mode
' Palette entry 26 is the color key. low = 26 high = 26
24-bit true-color mode
// Color red in hex is the color key. low = &HFF high = &HFF
Support for a range of colors rather than a single color is hardware-dependent. Check the lCKeyCaps member of the DDCAPS type for the hardware. The HEL does not support color ranges.