23.2.2 Adapting Identity Palettes to Different Display Adapters

Even if two display devices use the same number of system colors, you cannot assume that the red, green, and blue (RGB) values for the low-intensity colors match. One particular problem is the difference between super VGA and 8514 systems. Both provide 256 colors and use 20 system colors, but the low-intensity system color values for the VGA are different from those for the 8514. An identity palette created on a VGA system is not the same as an identity palette on an 8514 system.

If you create an identity palette on a VGA system and then display the DIB on an 8514 system, Windows recognizes the low-intensity colors in the logical palette as custom colors rather than system colors. It puts these colors in the custom-color section of the palette (in entries 10 through 245) and the 8514 system colors in the top and bottom of the system palette.

To avoid misrecognition of colors, an application can do the following:

1.When the application loads, it should use the GetSystemColors function to retrieve the system colors from the system palette and compare these colors against the system colors used in the DIB palettes.

2.If the colors do not match, the application should copy the current system colors (retrieved from the system palette) over the DIB system colors.