Graphics hardware can be built to support several types of colormap organizations. There are two principal paradigms for colormap hardware: we refer to these as color index style and gamma ramp style. In AIXwindows X server terminology, these two styles are known as PseudoColor and DirectColor, respectively. Hardware can be built to support one or both of these styles, in a variety of combinations.
In color-index mode (PseudoColor mode), the frame buffer stores color index values which are used to look up RGB values in a color lookup table (CLUT). The color lookup table, or colormap, may be on a per-window or a per-screen basis; that is, it may affect the contents of only a particular window, or of the entire screen.
In RGB mode (DirectColor mode), the frame buffer stores RGB triplets. If the hardware supports gamma ramps, then each component of the triplet is passed through a separate lookup table. That is, the red value stored in the frame buffer is passed through the red lookup table; the result is a new value for the red component. Likewise, the green and blue components pass through their own separate tables. These types of color tables are often referred to as gamma-ramps, since they are often used to gamma-correct RGB color values. Note that PseudoColor mode can be emulated with DirectColor mode: if exactly the same value is written into the red, green, and blue channels of the frame buffer (and that value is the color index), and the color map is loaded into the red, green, and blue gamma ramps, then the resulting system is identical to a PseudoColor System. Note that gamma ramps may be built to operate on a per-window or a per-screen basis.
Graphics hardware may be built with either or both types of color table organizations. In the following sections, supported graphics hardware is described, and how GL subroutines can be used to set the color tables.
The 24-bit High Performance 3D Color Graphics Processor contains per window color-index colormaps, and a single per-screen gamma ramp lookup table. In color index mode, the color-index table is used; in RGB mode, the color-index table is bypassed. In both modes, the gamma ramp tables are active and all RGB values, independent of their origin, pass through the gamma ramps. The mapcolors subroutine can be used to set the colormap; while the gammaramp subroutine can be used to set the gamma ramps.
On the 3D Color Graphics Processor, the cursor colormap is physically shared with the overlay color map. Changing the overlay colormap changes the color of the cursor. Changing the cursor colormap changes the overlay colormap. The X server manages the cursor, and that cursor colormap is reloaded whenever the cursor enters or leaves a window that has defined a special cursor.
EnterNotify and LeaveNotify events are generated by the X server whenever the cursor enters and leaves a window. Use the XSelectInput subroutine, with EnterWindowMask|LeaveWindowMask specified as the event mask.
The 24-bit POWERgraphics GTO does not have any color-index colormaps. It does however, contain multiple gamma-ramp style look up tables, and these operate on a per-window basis. In color index mode, the mapcolors subroutine can be used to set these lookup tables. When in color-index mode, the operation of the POWERgraphics GTO is indistinguishable from the operation of an adapter with actual, physical color-index style colormaps. This is due to the power of a DirectColor architecture to emulate a PseudoColor architecture, as discussed above. In color-index mode, the gammaramp subroutine has no effect on the POWERgraphics GTO.
In RGB mode, the gammaramp subroutine can be used to set the lookup tables. The tables are set on a per-window basis; that is, setting the color table for one window does not affect the others. If the gamma ramp needs to be set for multiple windows, it must be done so for each window individually. Use the winset subroutine to set the current window, and then use gammaramp to set the color table. By default, whenever the gconfig subroutine is called to configure an RGB mode window, the lookup table is initialized to a linear ramp.
The operation of the 24-bit POWER Gt4 and POWER Gt4x subroutines with regard to colormaps and gamma ramps is identical to that of the 24-bit POWERgraphics GTO in every respect.