Partager via


Setting Color Keys

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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 ddckCKSrcBlt and ddckCKDestBlt members of the DDSURFACEDESC structure that is passed to IDirectDraw::CreateSurface. To enable the color key for blitting, you must also include one or both of DDSD_CKSRCBLT or DDSD_CKDESTBLT in the dwFlags member.

To set a color key for an existing surface you use the IDirectDrawSurface::SetColorKey method.

You specify a key in the lpDDColorKey parameter and set either DDCKEY_SRCBLT or DDCKEY_DESTBLT in the dwFlags parameter to indicated whether you are setting a source or destination key. Destination color keying is not supported in the DirectDraw HEL.

If the DDCOLORKEY structure contains a range of colors, you must also set the DDCKEY_COLORSPACE flag.

If this flag is not set, only the dwColorSpaceLowValue member of the structure is used.

See Also

Concepts

Transparent Blitting