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_NOEXCLUSIVEMODE |
DDERR_INVALIDPARAMS | DDERR_NOCOOPERATIVELEVELSET |
DDERR_OUTOFCAPS | DDERR_OUTOFMEMORY |
DDERR_UNSUPPORTED |
dwFlags
DDPCAPS_1BIT
Indicates the index is 1 bit. There are two entries in the palette table.
DDPCAPS_2BIT
Indicates the index is 2 bits. There are four entries in the palette table.
DDPCAPS_4BIT
Indicates the index is 4 bits. There are sixteen entries in the palette table.
DDPCAPS_8BITENTRIES
An index to an 8-bit color index. This flag is only valid 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 one byte long and is an index to a destination surface's 8-bpp palette.
DDPCAPS_8BIT
Indicates the index is 8 bits. There are 256 entries in the palette table.
DDPCAPS_ALLOW256
Indicates 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 to be filled in with the address of the new DirectDrawPalette object if the IDirectDraw::CreatePalette method is successful.
pUnkOuter
Allows for future compatibility with COM aggregation features. Presently, however, IDirectDraw::CreatePalette returns an error if this parameter is anything but NULL.