Multiple Palettes for Off-Screen Surfaces

DirectDraw allows you to create multiple palettes that can be attached to off-screen surfaces. When this is done, the off-screen surfaces no longer share the palette of the primary surface. If you create an off-screen surface with a pixel format that is different from the primary surface's, it is assumed that the hardware can use it. For example, if a palettized off-screen surface is created when the primary surface is in 16-bit color mode, it is assumed that the blitter can convert palettized surfaces to true color during the blit operation.

DirectDraw allows you to create standard 8-bit palettized surfaces, which can display 256 colors, and two kinds of 4-bit palettized surfaces, each of which can display 16 colors. The first type of 4-bit palettized surface is indexed into a true-color color table; the second type is indexed into the indexed color table for the primary surface. This second type of palette provides 50 percent compression and a layer of indirection to the sprites stored using it.

If these surfaces are to be created, the blitter must be able replace the palette during the blit operation. Therefore, when a blit operation occurs from one palettized surface to another, the palette is ignored. Palette decoding is done only to true-color surfaces, or when the 4-bit palette is an index to an index in the 8-bit palette. In all other cases, the indexed palette is the palette of the destination.

Raster operations for palettized surfaces are ignored. Changing the attached palette of a surface is a very quick operation. All three of these palettized surfaces should be supported as textures on 3D-accelerated hardware.

For information about the pixel formats for off-screen plain surfaces, see Off-Screen Surface Formats.