IDirectDraw2::CreatePalette

HRESULT CreatePalette(DWORD dwFlags,

LPPALETTEENTRY lpColorTable,

LPDIRECTDRAWPALETTE FAR * lplpDDPalette,

IUnknown FAR * pUnkOuter);

Creates a DirectDrawPalette object for this DirectDraw object.

·Returns DD_OK if successful, or one of the following error values otherwise:

DDERR_INVALIDOBJECT

DDERR_INVALIDPARAMS

DDERR_NOCOOPERATIVELEVELSET

DDERR_NOEXCLUSIVEMODE

DDERR_OUTOFCAPS

DDERR_OUTOFMEMORY

DDERR_UNSUPPORTED

dwFlags

One or more of the following flags:

DDPCAPS_1BIT

Indicates that the index is 1 bit. There are two entries in the color table.

DDPCAPS_2BIT

Indicates that the index is 2 bits. There are four entries in the color table.

DDPCAPS_4BIT

Indicates that the index is 4 bits. There are 16 entries in the color table.

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 bpp. Each color entry is 1 byte long and is an index to a destination surface's 8-bpp palette.

DDPCAPS_8BIT

Indicates that the index is 8 bits. There are 256 entries in the color table.

DDPCAPS_ALLOW256

Indicates that this palette can have all 256 entries defined.

lpColorTable

Address of an array of 2, 4, 16, or 256 PALETTEENTRY structures that will initialize this DirectDrawPalette object.

lplpDDPalette

Address of a pointer that will be filled with the address of the new DirectDrawPalette object if this method returns successfully.

pUnkOuter

Allows for future compatibility with COM aggregation features. Presently, however, IDirectDraw2::CreatePalette returns an error if this parameter is anything but NULL.