gpi12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GpiQueryNearestColor (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPILOGCOLORTABLE
 
LONG GpiQueryNearestColor(hps, flOptions, lRgbColorIn)
HPS hps;             /* presentation-space handle */
ULONG flClrType;     /* color type                */
LONG lRgbColorIn;    /* RGB color value           */
 
The GpiQueryNearestColor function returns the RGB color value from the
physical palette that most closely matches the RGB color value specified by
the lRgbColorIn parameter. The function uses the physical palette of the
device associated with the given presentation space.
 
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 RGB color 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 RGB color value is based on realized
             colors. If it is LCOLOPT_REALIZED, the function returns a RGB
             color 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 RGB color based on the colors in
             the current physical palette.
 
lRgbColorIn  Specifies a RGB color value.
 
Return Value
 
The return value is the nearest available color if the function is
successful or GPI_ALTERROR 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
 
GpiCreateLogColorTable, GpiQueryColorData, GpiQueryRealColors,
GpiQueryRGBColor, WinGetLastError