Querying the Available Colors

Several query functions are provided for applications to get information about the current logical and physical color tables before defining a logical color table.

Applications use GpiQueryColorData to determine whether the default logical color table is in effect. If it is not, the following information about the loaded logical color table is returned:

GpiQueryRealColors returns the RGB values of each of the distinct colors defined in the physical color table of the current device. It also can return the index in the current logical color table that references each of the colors in the physical table.

To determine the available colors nearest to a specified color on a particular device, call GpiQueryNearestColor, which accepts as input the RGB value of the desired color. The function returns the RGB value of the nearest available color in the physical color table of the associated device.

Applications can use GpiQueryRGBColor to determine the RGB value of a particular color. GpiQueryRGBColor accepts as input the index to the logical color table entry of the color in question. Output from this function is the RGB value that the index would reference in the physical color table. If a logical color table is loaded in RGB mode, GpiQueryRGBColor returns the same results as GpiQueryNearestColor.

Conversely, to determine the index value that references a given RGB color (or the closest match to that color) in the physical color table, an application uses GpiQueryColorIndex. The application can determine which colors are in the current logical color table by calling GpiQueryLogColorTable. To determine which colors are in the physical color table, call GpiQueryRealColors.


[Back: Color Tables in RGB Mode]
[Next: Physical Color Table]