Important:
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 version of this page is also available for
4/8/2010

Like other types of surfaces, overlay surfaces use source and destination color keys for controlling transparent blit operations between surfaces.

Because overlay surfaces are not displayed by blitting, there needs to be a different way to control how an overlay surface is displayed over the primary surface when you call the IDirectDrawSurface::UpdateOverlaymethod. This need is filled by overlay color keys.

Overlay color keys, like their blit-related counterparts, have a source version and a destination version that you set by calling the IDirectDrawSurface::SetColorKeymethod. (For more information, see Setting Color Keys.)

You use the DDCKEY_SRCOVERLAY or DDCKEY_DESTOVERLAY flags to set a source or destination overlay color key.

Overlay surfaces can employ blit and overlay color keys together to control blit operations and overlay display operations appropriately; the two types of color keys do not conflict with one another.

The IDirectDrawSurface::UpdateOverlaymethod uses the source overlay color key to determine which pixels in the overlay surface should be considered transparent, allowing the contents of the primary surface to show through.

Likewise, the method uses the destination overlay color key to determine the parts of the primary surface that will be covered up by the overlay surface when it is displayed. The resulting visual effect is the same as that created by blit-related color keys.