Free color cells are the most precious resource on the most common 8 plane display screens (256 colors for all appilcations). For this reason and that the majority of graphics applications use a single 3DCanvas widget, EZwgl uses a single colormap. The consequence is that all 3DCanvases of any given application must share a common physical colormap. This means that a change of color in any of the 3DCanvases may affect all 3DCanvases. This is, of course, not a problem if you have a TrueColor/DirectColor visual or use the (simulated) RGB display mode.
On 8bit deep visuals, the EZ graphics library claims all the free color cells in the default colormap at initialization time. If it cannot allocate a minimal set of 44 colors, it either gives up or, in the case of PseudoColor visuals, switches to a private colormap.
Internally, EZwgl uses a color table with 256 entries,
in which the first 16 and the last few entries are reserved for the EZ
widget library. The middle or
or
or
entries
are reserved for the EZ graphics library.
As a consequence, a graphics application can have at
most 216 colors in ColorMap (index) mode; assuming that we can allocate
all 256 colors (e.g. using a private colormap).
Also, the color index should start at 16 or it
may affect the appearance of EZ widgets.
The EZ graphics library provides two functions for inquiring about the number of available colors.
int EZ_GetNumberOfReservedColorsForGL(void)
This function returns the number of reserved colors for the EZ graphics library. Start at index 16. For example, if this function returns 125, it means entries from 16 to 131 are reserved for the graphics library.
int EZ_GetNumberOfAllocatedColors(void)
This function returns the total number of colors allocated by EZwgl. The first 16 entries are pre-allocated and normally, should not be modified.
The pre-allocated color entries are listed in the following table.
index | color name | RGB triple |
BLACK (0) | black | (0,0,0) |
GRAY1 (1) | gray38 | (97,97,97) |
GRAY2 (2) | gray46 | (117,117,117) |
GRAY3 (3) | gray50 | (150,150,150) |
GRAY4 (4) | gray74 | (189,189,189) |
GRAY5 (5) | gray84 | (214, 214, 214) |
GRAY6 (6) | gray87 | (222,222,222) |
GRAY7 (7) | gray93 | (237,237,237) |
WHITE (8) | gray100 | (255,255,255) |
DARKRED (9) | red4 | (139,0,0) |
RED (10) | red1 | (255,0,0) |
GREEN (11) | green1 | (0,255,0) |
BLUE (12) | blue1 | (0,0,255) |
YELLOW (13) | yellow | (255,255,0) |
MAGENTA (14) | magenta | (255,0,255) |
CYAN (15) | cyan | (0,255,255) |
Entries 1--7 are used for displying widget borders. If a global
border has been set, or an application uses the
-background
command
line option, these entries may be modified.