Modifies the color table of the currently selected WinGBitmap in a WinGDC.
UINT WinGSetDIBColorTable( HDC hWinGDC, UINT StartIndex, UINT NumberOfEntries, RGBQUAD far *pColors )
Parameters
hWinGDC | Identifies the WinG device context whose color table should be modified. |
StartIndex | Indicates the first palette entry to be changed. |
NumberOfEntries | Indicates the number of palette entries to change. |
pColors | Points to a buffer which contains the new color table values. |
Return Value
Returns the number of palette entries modified in the specified device context or 0 if it failed.
Comments
The pColors buffer must hold at least NumberOfEntries RGBQUAD structures.
If you want to update the display immediately (for example, in palette animation), use AnimatePalette to modify the system palette and then call WinGSetDIBColorTable to match it or the WinGDC will be remapped when it is blted. See the Palette Animation With WinG article for more information and sample code that does this.
Note that StartIndex indicates an entry in a palette array, which is zero-based. NumberOfEntries indicates a one-based count. If NumberOfEntries is zero, no color table entries will be modified.
Maximizing Performance
It is not necessary to call WinGSetDIBColorTable every time you call AnimatePalette. Only call this API if you are about to blt and the destination palette has changed since the last call to WinGSetDIBColorTable.
Example
See the section titled Palette Animation With WinG for sample code and discussion of using WinGSetDIBColorTable to perform palette animation.
The PALANIM sample, in the SAMPLES\PALANIM subdirectory of the WinG Development Kit, performs simple palette animation and maintains an identity palette throughout.
See Also
WinGGetDIBColorTable WinGCreateBitmap Palette Animation With WinG