Drawing Color Graphics on Monochrome Devices

When mapping color graphics to a monochrome device (screen, printer, or bit map), the monochrome device has a reset color and a contrast color. The reset color is the color GpiErase clears to and is either black or white. If the reset color is black, the contrast color is white, and if the reset color is white, the contrast color is black.

To determine whether the reset color is to be black or white, the color retrieved by the index CLR_BACKGROUND from the current logical color table is examined. If a logical color table has not been loaded, CLR_BACKGROUND is either the paper color on a printer or SYSCLR_WINDOW on a display. If a logical color table has been loaded, CLR_BACKGROUND is the color addressed by color index 0 on any device.

If the color retrieved by CLR_BACKGROUND is either white or black, that color becomes the reset color. For example, if an application is drawing to a screen, has not loaded a color table, and the system colors have not been altered, the background color is white, because SYSCLR_WINDOW produces a white background by default. In this instance, the contrast color is black.

If the color retrieved by CLR_BACKGROUND is neither white nor black, the color translates to whichever of black and white it is nearest to. As a rule, dark colors produce a black background, and pale colors produce a white background. For example, if an application is using a loaded color table, or if the color retrieved by SYSCLR_WINDOW has been altered (either interactively or by WinSetSysColors), CLR_BACKGROUND could be dark gray. In this instance, the reset color would be black, and the contrast color would be white.

When the reset color has been established, the PM applies the following rules when mapping color graphics to a monochrome device: