Microsoft DirectX 9.0

IDirectDraw::CreatePalette

The CreatePalette method creates a DirectDrawPalette object for this DirectDraw object.

Syntax

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

Parameters

dwFlags

May be one of the following values.

Value Description
DDPCAPS_4BIT Index is 4 bits. There are sixteen color entries in the palette table.
DDPCAPS_8BITENTRIES Index is onto an 8-bit color index. This member is only valid with the DDPCAPS_4BITINDEX capability and the target surface is in 8bpp. Each color entry is one byte long and is an index into the destination surface's 8bpp palette.
DDPCAPS_8BIT Index is 8 bits. There are 256 color entries in the palette table.
DDPCAPS_ALLOW256 This palette can have all 256 entries defined.
DDPCAPS_INITIALIZE Indicates that this DirectDrawPalette object should use the palette color array passed into the lpDDColorArray parameter to initialize the DirectDrawPalette object.

lpColorTable

Points to an array of 16 or 256 PALETTEENTRY structures that should be used to initialize this DirectDrawPalette object.

lplpDDPalette

Points to a pointer which will be filled in with the address of the new DirectDrawPalette object if the CreatePalette method is successful.

pUnkOuter

This parameter is provided for future compability with COM aggregation features. Presently, however, CreatePalette will return an error if it is anything but NULL.

Return Values

Value Description
DD_OK The method succeeded.
DDERR_INVALIDOBJECT The object is invalid.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_NOCOOPERATIVELEVELSET Create function called without SetCooperativeLevel being called.
DDERR_NOEXCLUSIVEMODE Operation requires the application to have exclusive mode but the application does not have exclusive mode.
DDERR_UNSUPPORTED Action not supported.
DDERR_OUTOFMEMORY DirectDraw does not have enough memory to perform the operation.
DDERR_OUTOFCAPS The hardware needed for the requested operation has already been allocated.

See Also