Realizing a Color Palette

WinRealizePalette maps the colors requested by the application into the color palette for the system. When the application's window is activated, the palette changes are transferred, or realized, into the physical palette for the system.

When a palette is realized, there might not be enough empty palette entries to accommodate the additional palette changes (a maximum of 256 entries). For example, it is possible that some of the colors changed in the physical palette are being used by another application. In this situation, a WM_REALIZEPALETTE message is posted to all the applications running on the desktop.

On receiving the WM_REALIZEPALETTE message, applications using palette manager functions must repaint their screens. The original application colors are mapped to the closest matching color in the new palette. Applications that do not use palette manager functions normally perform default processing within their applications causing a repaint of their windows with the closest match from the palette. If there are no changes, just additions, to the physical palette, no message is sent.

Note: The palette manager maps a window's colors to the closest available value in the palette when the physical palette has to be changed, but this does not guarantee that the color will be a close match to the original color used.

As the focus changes from window to window, the physical palette changes according to the activated window. Notification messages are sent as necessary to other applications.

If the physical color values in the palette have to change to accommodate the number of palette entries passed from the application when a palette is realized, the number of altered entries in the physical palette is returned by WinRealizePalette.

Color palette realization is available only to systems that have a minimum of 256 colors.


[Back: Palette Manager]
[Next: Color Attribute]