The DirectDrawPalette object is provided to enable direct manipulation of 16- and 256-color palettes. DirectDrawPalette reserves entries 0 through 255 for 256-color palettes; however, it reserves no entries for 16-color palettes. It allows direct manipulation of the palette table as a table. This table can contain 16- or 24-bit RGB entries representing the colors associated with each of the indexes. For 16-color palettes, the table can also contain indexes to another 256-color palette.
Entries in these tables can be retrieved with the IDirectDrawPalette::GetEntries method and changed with the IDirectDrawPalette::SetEntries method. The IDirectDrawPalette::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.
Two approaches can be used to provide straightforward palette animation using DirectDrawPalette objects. The first approach involves changing the palette entries that correspond to the colors that need to be animated. This can be done with a single call to the IDirectDrawPalette::SetEntries method. The second approach requires two DirectDrawPalette objects. The animation is performed by attaching first one object then the other to the DirectDrawSurface. This can be done using the IDirectDrawSurface::SetPalette method.