2.3.3 Color-Palette Functions

Windows color palettes allow an application to use as many colors as needed without interfering with its own color display or colors displayed by other windows. Following are the functions an application calls to use color palettes:

Function Description

AnimatePalette Replaces entries in a logical palette; Windows maps the new entries into the system palette immediately.
CreatePalette Creates a logical palette.
GetNearestColor Retrieves the solid color closest to a specified logical color that a given device can represent.
GetNearestPaletteIndex Retrieves the index of a logical palette entry most nearly matching a specified RGB value.
GetPaletteEntries Retrieves entries from a logical palette.
GetSystemPaletteEntries Retrieves a range of palette entries from the system palette.
GetSystemPaletteUse Determines whether an application has access to the full system palette.
ResizePalette Changes the size of the specified logical palette.
SetPaletteEntries Sets new palette entries in a logical palette; Windows does not map the new entries to the system palette until the application realizes the logical palette.
SetSystemPaletteUse Allows an application to use the full system palette.
UpdateColors Performs a pixel-by-pixel translation of each pixel's current color to the system palette. This process allows an inactive window to correct its colors without redrawing its client area.

The USER API also provides two palette-management functions:

Function Description

RealizePalette Maps entries in a logical palette to the system palette.
SelectPalette Selects a logical palette into a device context.

For more information about these USER functions, see Chapter 1, “Window Management.”