The default logical color table is defined as an array of color indexes and their associated RGB values. A table in this format is in index mode.

To alter a logical color table in index mode, specify either LCOLF_INDRGB or LCOLF_CONSECRGB as the format value in GpiCreateLogColorTable. If an application uses the color index names to address the contents of a loaded color table in index mode, the color identified by the associated index number is retrieved. For example, CLR_NEUTRAL produces the color addressed by index number 7. If CLR_NEUTRAL must be blue, the application must define the color table so that index number 7 addresses the RGB definition of the appropriate shade of blue.

If an application uses the format LCOLF_INDRGB when calling GpiCreateLogColorTable, the application supplies an array of index and RGB pairs to update the table. These values do not have to be consecutive. An application can change the contents of an existing table and add entries to the end of the table.

If an application calls GpiCreateLogColorTable using the LCOLF_CONSECRGB format, the application supplies an array of RGB values and a starting index. When using this format, the RGB values must be consecutive. You cannot use a single call to GpiCreateLogColorTable to redefine CLR_BLUE and CLR_PINK without also specifying an RGB value for CLR_RED. As with LCOLF_INDRGB, this format can be used to change the contents of the existing table and to add entries to the end of the table.

When an application calls GpiSetAttrs to put a value into the color field of a graphics primitive attribute structure, the value is an index into the logical color table. When the operating system draws the primitive, it uses this index to determine the RGB value specified in the logical color table by the application. It then searches the physical color table for the color closest to this RGB value. The operating system then draws the primitive, using the color from the physical color table. How closely the drawn colors match the colors in the logical color table depends on the device colors in the physical color table.


[Back] [Next]