## Presentation Device Driver Reference for OS/2

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

### GreQueryNearestColor - Syntax

Simulation support:

None. This function is mandatory for all drivers.

Description:

GreQueryNearestColor returns the available color nearest to the specified color on the currently associated device even if it is not available in the logical color table. Both colors are specified as RGB values.

This function must be supported by the presentation driver. GreQueryNearestColor is called by GpiQueryNearestColor when the application wants the available colors nearest to the specified color.

    #define INCL_GRE_COLORTABLE

    #include <os2.h>

    HDC      hdc;         /*  Device context handle. */

    ULONG    flOptions;   /*  Options flag. */

    LONG     rgbColorIn;  /*  Color required. */

    PVOID    pInstance;   /*  Pointer to instance data. */

    ULONG    lFunction;   /*  High-order WORD=flags; low-order WORD=NGreQueryNearestColor. */

    LONG     rc;          /*  Return Code. */

    rc = GreQueryNearestColor(hdc, flOptions,

           rgbColorIn, pInstance, lFunction);