Microsoft DirectX 9.0

IDirectDrawSurface::SetColorKey

The SetColorKey method sets the color key value for the DirectDrawSurface object if the hardware supports color keys on a per surface basis.

Syntax

HRESULT SetColorKey(
  DWORD dwFlags,
  LPDDCOLORKEY lpDDColorKey
);

Parameters

dwFlags

Determines which color key is being requested.

Value Description
DDCKEY_COLORSPACE Set if the structure contains a colorspace. Not set if the structure contains a single color key.
DDCKEY_DESTBLT Set if the structure specifies a color key or color space which is to be used as a destination color key for blit operations.
DDCKEY_DESTOVERLAY Set if the structure specifies a color key or color space which is to be used as a destination color key for overlay operations.
DDCKEY_SRCBLT Set if the structure specifies a color key or color space which is to be used as a source color key for blit operations.
DDCKEY_SRCOVERLAY Set if the structure specifies a color key or color space which is to be used as a source color key for overlay operations.

lpDDColorKey

Points to the DDCOLORKEY structure which has the new color key values for the DirectDrawSurface object.

Return Values

Value Description
DD_OK The method succeeded.
DDERR_NOOVERLAYHW Operation could not be carried out because there is no overlay hardware present or available.
DDERR_COLORKEYDRIVERWIDE The driver has no color key capabilities of any type.
DDERR_NODESTCLRKEYHW The driver has no destination color key capabilities.
DDERR_NOSRCCLRKEYHW The driver has no source color key capabilities.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_INVALIDOBJECT DirectDraw received a pointer that was an invalid DirectDraw object.
DDERR_SURFACELOST Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.
DDERR_UNSUPPORTED Action not supported.
DDERR_WASSTILLDRAWING Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.
DDERR_GENERIC Generic failure.
DDERR_NOTAOVERLAYSURFACE Returned when an overlay method is called for a non-overlay surface.

See Also