## Presentation Device Driver Reference for OS/2

[prev][next][parent][TOC]

### GreQueryNearestColor - Remarks

The color used for drawing primitives, such as lines and text, is the color returned. GreQueryNearestColor does not consider the possibility of using dithered colors for filling areas. Where dithered colors are used for filling, the color used for text and lines is likely to be different even when the same color index is selected.

The nearest color is determined by finding its position in RGB space. "RGB space" can be defined as a cube with three axes (representing red, green and blue color intensities) radiating from one corner or origin. Moving up the Red axis results in increasing red intensity. Different intensities of cyan can be produced by moving along the Green and Blue axes. For EGA and VGA devices, dithering is performed by dividing the RGB space into 9x9x9 cubical cells representing the colors that can be created. The cell each RGB color falls into is determined and a lookup table is created to indicate which EGA planes to set ON or OFF to create each color.

When this function is called for a monochrome device, the color returned is either the reset color or the contrast color for the device. See Support for Monochrome Devices.