In DirectX 2, DirectDraw supports 1-bit (2 entry), 2-bit (4 entry) and 4-bit (16 entry) palettes in addition to the 8-bit (256 entry) palettes supported by previous versions. Such palettes can be created by specifying one of the new palette capability flags: DDPCAPS_1BIT, DDPCAPS_2BIT, and DDPCAPS_4BIT. Matching capability flags have been added for surface pixel formats: DDPF_PALETTEINDEXED1, DDPF_PALETTEINDEXED2, and DDPF_PALETTEINDEXED4.
A palette can only be attached to a surface with a matching pixel format. For example, a 2 entry palette created with the DDPCAPS_1BIT flag can only be attached to a 1-bit surface created with the pixel format flag DDPF_PALETTEINDEXED1.
Furthermore, it is now possible to create indexed palettes. An indexed palette is one whose entries do not hold RGB colors, but rather integer indices into the array of PALETTEENTRYs of some target palette. An indexed palette's color table is an array of 2, 4, 16, or 256 bytes, where each byte is an index into some unspecified, destination palette.
To create an indexed palette, specify the palette capability flag DDPCAPS_8BITENTRIES when calling the IDirectDraw::CreatePalette method. For example, to create a 4-bit, indexed palette, specify DDPCAPS_4BIT | DDPCAPS_8BITENTRIES. When creating an indexed palette, a pointer to an array of bytes is passed rather than a pointer to an array of PALETTEENTRY structures. The pointer to the array of bytes must be cast to an LPPALETTEENTRY when calling IDirectDraw::CreatePalette.