Creating a Logical Color Table

To create a logical color table, the application creates an array of RGB values that replace the existing logical color table, then calls GpiCreateLogColorTable, using the LCOL_RESET and LCOLF_CONSECRGB flags. The following figure demonstrates this process.

#define INCL_GPILOGCOLORTABLE
#include <os2.h>

void fncCOLR01(void){
    HPS hps;
    LONG alTable[] = {
        0xFFFFFF,        /* White */
        0xFF88FF,
        0xFF8800,
        0xFF8888,
        0xFF0088,
        0x880088,
        0x008888,
        0x00FF88,
        0x00F800,
        0x008800,
        0x000088,
        0x0000F8,
        0x0800F8,
        0x888888,
        0x080808,
        0x000000 };      /* Black */

    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);
} /* fncCOLR01 */


[Back: Using Color and Mix Attributes]
[Next: Determining the Color-Table Format and Index Values]