 |
» |
|
|
 |
TrueColor Visual Description |  |
A TrueColor visual can be thought of as having a read-only
color map where, for any given pixel value, about one third of the
bits are used to describe each of the red, green, and blue colors,
respectively. For an 8-plane TrueColor visual, 3 bits describe the
red component, 3 bits describe the green component, and 2 bits describe
the blue component. A 12-plane TrueColor visual uses 4 bits each
to describe the red, green, and blue components. A 24-plane TrueColor
visual uses 8 bits each to describe the red, green, and blue components.
This is illustrated as follows: The following example refers to an 8-plane TrueColor visual;
however, the example can be expanded to apply to 12-plane or 24-plane
TrueColor visuals. Since the red and green components consist of 3 bits each,
there are 8 different shades of red and 8 different shades of green
available. Also, there are 4 different shades of blue represented
by 2 bits. As the component increases, the intensity of that color
increases. For example, a red component of 000 represents no red,
and a red component of 111 represents full red. Therefore, pixel
value 0 is 000 red, 000 green, and 00 blue, which results in black.
Pixel value 255 is 111 red, 111 green, and 11 blue, which results
in white. These and other examples are shown in Table 2-3 “Examples of Pixel Color Values ”. Table 2-3 Examples of Pixel Color Values Pixel Value | Binary | Red | Green | Blue |
|---|
0 | 000 000 00 | shade 0 | shade 0 | shade 0 | 53 | 001 101 01 | shade 1 | shade 5 | shade 1 | 139 | 100 010 11 | shade 4 | shade 2 | shade 3 | 218 | 110 110 10 | shade 6 | shade 6 | shade 2 | 255 | 111 111 11 | shade 7 | shade 7 | shade 3 |
Note that the red, green and blue intensities for the color
shades ramp uniformly between 0 and 255. Device Specific Visuals Information |  |
Note that the TrueColor Visual always uses a shade_mode
of CMAP_FULL.
When the TrueColor visual window is gopened,
your application will automatically be in CMAP_FULL
mode and the shade_mode
call will ignore any attempts to go into another mode. With the addition of the TrueColor visual (beginning with
the 9.03 release of HP-UX), you need to consider the following information: If you originally created your windows
using command lines similar to the following: xwcreate -g 600x500+300+200 -depth 8 window xwcreate -g 600x500+300+200 -depth 24 window |
you will have to change how you create your windows by using
command lines similar to these: xwcreate -g 600x500+300+200 -depth 8 -visual TrueColor \ window xwcreate -g 600x500+300+200 -depth 24 -visual \ TrueColor window |
Note the addition of the command line option -visual
for declaring TrueColor and DirectColor visuals. The TrueColor color map is a read-only color map
and cannot be modified. You should note that any attempt to modify
the TrueColor color map will not cause an error. One class of applications that could be affected by this color
map description are those that perform their own gamma correction.
This is because the color map is read-only, thus preventing Starbase
from adjusting the color ramp to perform gamma correction. If your application searches for a visual by traversing
the visual list that is returned by the X server, you will find
that the order of visuals in this list may change from device to
device and release to release. Therefore, your application code
should always explicitly search for a particular visual rather than
assuming that it occurs in a fixed position within the list of visuals
returned by X11.
|