Microsoft DirectX 9.0

IDirectDrawPalette Interface

The DirectDrawPalette object enables direct manipulation of 16- and 256-color palettes. It reserves entries 0 and 255 for 256-color palettes. It reserves no entries for 16-color palettes. It allows direct manipulation of the palette table as a table. This table can have 16- or 24-bit RGB entries representing the colors associated with each of the indexes or, for 16-color palettes, it can also contain indexes to another 256-color palette.

Entries in these tables can be retrieved with the GetEntries method and changed with the SetEntries method. The SetEntries method has a dwFlags parameter that specifies when the changes to the palette should take effect.

DirectDrawPalette objects are usually attached to DirectDrawSurface objects.

Palette animation is straightforward using DirectDrawPalette objects. There are two approaches. The first involves simply changing the palette entries that correspond to the colors which need to be animated. This can be done with a single call to the SetEntries method. The second one requires two DirectDrawPalette objects. The animation is performed by attaching first one object and then the other to the DirectDrawSurface. This can be done using the SetPalette method of the DirectDrawSurface objects.

In addition to the methods inherited from IUnknown, the IDirectDrawPalette interface contains the following methods.

Method Description
GetCaps Return the capabilities of this palette object.
GetEntries Query palette values from a DirectDrawPalette.
Initialize This method is provided for compliance with the Common Object Model (COM) protocol.
SetEntries Change entries in a DirectDrawPalette.