## Presentation Device Driver Reference for OS/2

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

### GreQueryColorIndex

Select an item:

    Syntax
    Parameters
    Returns
    Glossary

Simulation support:

None. This function is mandatory for all drivers.

Description:

GreQueryColorIndex returns the logical color index that is closest to the specified RGB color representation for the device. If the color index is in RGB mode, the supplied RGB value is returned.

This function must be supported by the presentation driver. GreQueryColorIndex is called by GpiQueryColorIndex when an application requests the index of the color most closely matching a specified color, relative to the current logical color table for the device context.

    #define INCL_GRE_COLORTABLE

    #include <os2.h>

    HDC      hdc;        /*  Device context handle. */

    ULONG    flOptions;  /*  Options flag. */

    LONG     rgbColor;   /*  Color, as an RGB value. */

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

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

    LONG     rc;         /*  Return Code. */

    rc = GreQueryColorIndex(hdc, flOptions, rgbColor,

           pInstance, lFunction);