Sharing Palettes
Palettes can be shared among multiple surfaces. The same palette can be set on the front buffer and the back buffer of a flipping chain or shared among multiple texture surfaces. When an application attaches a palette to a surface by using the IDirectDrawSurface5::SetPalette method, the surface increments the reference count of that palette. When the reference count of the surface reaches 0, the surface will decrement the reference count of the attached palette. In addition, if a palette is detached from a surface by using IDirectDrawSurface5::SetPalette with a NULL palette interface pointer, the reference count of the surface's palette will be decremented.
**Note **If IDirectDrawSurface5::SetPalette is called several times consecutively on the same surface with the same palette, the reference count for the palette is incremented only once. Subsequent calls do not affect the palette's reference count.
© 1992-2003 Microsoft Corporation. All rights reserved.