Texture Palettes


Microsoft DirectX 9.0 for Managed Code supports paletted textures through a set of 256 entry palettes associated with a Device object. A palette is made current by setting the Device.CurrentTexturePalette property. The current palette is used for translating all paletted textures for all active texture stages. The Device.SetPaletteEntries method updates all of a palette's 256 entries. Each entry is a PaletteEntry structure of type Format.A8R8G8B8. All entries default to 0xFFFFFFFF.

The Device palettes contain an alpha channel that can be used when the TextureCaps.SupportsAlphaPalette device capability flag is set, indicating that the device supports alpha from the palette. The palette alpha channel is used when the texture format does not have an alpha channel. If the device does not support alpha from the palette and the texture format does not have an alpha channel, a value of 0xFF is used for alpha.

There is a maximum of 65,536 (0x0000FFFF) palettes. Because memory resources associated with the set of palettes are proportional to the maximum palette number that an application references, contiguous palette numbers starting at zero should be used.


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center