gpi12.hlp (Table of Contents; Topic list)
GpiQueryColorIndex (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPILOGCOLORTABLE
 
LONG GpiQueryColorIndex(hps, flClrType, lRgbColor)
HPS hps;            /* presentation-space handle */
ULONG flClrType;    /* color type                */
LONG lRgbColor;     /* RGB color value           */
 
The GpiQueryColorIndex function returns a color index for the specified RGB
color value. The function maps the RGB color value to the closest match in
the physical palette for the device associated with the presentation space.
It then returns the index in the current logical color table that
corresponds to this physical-palette color.
 
If the current logical color table is realizable but has not been realized,
the LCOLOPT_REALIZED option maps the RGB color value as if the logical color
table has been realized. Since realizing a logical color table affects the
contents of the physical palette, the color index value returned with this
option may be different than the value returned without the option.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hps        Identifies the presentation space.
 
flClrType  Specifies whether the color index is based on realized colors. If
           it is LCOLOPT_REALIZED, the function returns a color index based
           on the colors in the physical palette after the current logical
           color table is realized. If the parameter is zero, the function
           returns a color index based on the colors in the current physical
           palette.
 
lRgbColor  Specifies the RGB color value.
 
Return Value
 
The return value is a color index that is the closest possible match of the
specified color if the function is successful, or QLCT_ERROR if an error
occurred.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INV_COLOR_OPTIONS
     PMERR_INV_HPS
     PMERR_INV_RGBCOLOR
     PMERR_PS_BUSY
 
See Also
 
GpiQueryLogColorTable, GpiQueryRGBColor