Partager via


IDirectDraw4::CreatePalette

This method creates a DirectDrawPalette object for this DirectDraw object.

HRESULT CreatePalette( 
  DWORD dwFlags, 
  LPPALETTEENTRY lpDDColorArray, 
  LPDIRECTDRAWPALETTE FAR* lplpDDPalette, 
  IUnknown FAR* pUnkOuter
);

Parameters

  • dwFlags
    The following table shows the possible flags.

    Flag Description
    DDPCAPS_8BITENTRIES Indicates that the index refers to an 8-bit color index. This flag is valid only when used with the DDPCAPS_1BIT, DDPCAPS_2BIT, or DDPCAPS_4BIT flag, and when the target surface is in 8 bits per pixel (BPP). Each color entry is 1 byte long and is an index to a destination surface's 8-BPP palette.
    DDPCAPS_ALPHA Indicates that the peFlags member of the associated PALETTEENTRY structure is to be interpreted as a single 8-bit alpha value (in addition to the peRed, peGreen, and peBlue members). A palette created with this flag can only be attached to a texture, which is a surface created with the DDSCAPS_TEXTURE capability flag.
    DDPCAPS_ALLOW256 Indicates that this palette can have all 256 entries defined.
    DDPCAPS_INITIALIZE Initialize this palette with the colors in the color array passed at lpDDColorArray.
    DDPCAPS_PRIMARYSURFACE This palette is attached to the primary surface. Changing this palette's color table immediately affects the display unless DDPSETPAL_VSYNC is specified and supported.
    DDPCAPS_PRIMARYSURFACELEFT This palette is the one attached to the left eye primary surface. Changing this palette's color table immediately affects the left eye display unless DDPSETPAL_VSYNC is specified and supported.
    DDPCAPS_VSYNC This palette can have modifications to it synced with the monitor's refresh rate.

    The following flags are not supported in Windows CE.

    Flags not supported in Windows CE
    DDPCAPS_1BIT
    DDPCAPS_2BIT
    DDPCAPS_4BIT
    DDPCAPS_8BIT
  • lpDDColorArray
    Address of an array of 2, 4, 16, or 256 PALETTEENTRY structures that will initialize this DirectDrawPalette object.

  • lplpDDPalette
    Address of a variable that will be set to a valid IDirectDrawPalette interface pointer if the call succeeds.

  • pUnkOuter
    Allows for future compatibility with COM aggregation features. Presently, this method will return an error if this parameter is anything but NULL.

Return Values

If the method succeeds, the return value is DD_OK.

If the method fails, the return value may be one of the following error values:

DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_NOCOOPERATIVELEVELSET
DDERR_OUTOFMEMORY
DDERR_UNSUPPORTED

Remarks

The DDPCAPS_PRIMARYSURFACE and DDPCAPS_PRIMARYSURFACELEFT flags are not used in Windows CE, as palettized primary surfaces and display modes are currently unsupported.

Requirements

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header: Ddraw.h.
Link Library: Ddraw.lib.

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.