|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.|
You can set the source or destination color key for a surface either when creating it or afterwards.
To set a color key or keys when creating a surface, you assign the appropriate color values to one or both of the ddckCKSrcBltand ddckCKDestBltmembers of the DDSURFACEDESC2structure that is passed to IDirectDraw4::CreateSurface. To enable the color key for blitting, you must also include one or both of DDSD_CKSRCBLT or DDSD_CKDESTBLT in the dwFlagsmember.
To set a color key for an existing surface you use the IDirectDrawSurface5::SetColorKeymethod. You specify a key in the lpDDColorKeyparameter and set either DDCKEY_SRCBLT or DDCKEY_DESTBLT in the dwFlagsparameter to indicated whether you are setting a source or destination key. If the DDCOLORKEYstructure contains a range of colors, you must also set the DDCKEY_COLORSPACE flag. If this flag is not set, only the dwColorSpaceLowValuemember of the structure is used.
Last updated on Tuesday, May 18, 2004