Determining the Color-Table Format and Index Values

To determine the format and the starting and ending index values of the current logical color table, applications call GpiQueryColorData. The following figure is an example of using GpiQueryColorData to determine whether the default logical color table is loaded. If so, the code fragment loads a new table.

#define INCL_GPILOGCOLORTABLE
#include <os2.h>

void fncCOLR02(void){
    HPS hps;
    LONG        aClrData[3];
    LONG alTable[16];

    GpiQueryColorData(hps, 3, aClrData);

    if (aClrData[QCD_LCT_FORMAT] == LCOLF_DEFAULT)
        GpiCreateLogColorTable(hps,
           LCOL_RESET,                      /* Start with the default      */
           LCOLF_CONSECRGB,                 /* Consecutive RGB values      */
           0,                               /* Starting index in table     */
           sizeof(alTable) / sizeof(LONG),  /* Number of elements in table */
           alTable);
} /* fncCOLR02 */


[Back: Creating a Logical Color Table]
[Next: Determining the Index Value of an RGB Value]