HP (Hewlett-Packard) HP-UX Time Clock User Manual


 
_HP_RGB_SMOOTH_MAP_LIST is a list of colormaps that are associated with window visual IDs that
support Color Recovery. When the XGetRGBColormaps routine searches this list for a colormap with a
visual ID that matches your window's visual ID and it finds one, your application knows that your visual
supports Color Recovery, and uses that colormap for any Color Recovery window in your window's
visual.
Color Recovery uses all 256 entries of one of the available colormaps. The color visual used by Color
Recovery emulates the 24-bit TrueColor visual, thus, the colors red, green, and blue are typically
declared as integers in the range from 0 to 255. Each window that uses Color Recovery will have the
same colormap contents.
For Color Recovery to produce the best results, the emulated 24-bit TrueColor data is dithered as
explained below.
A pixel to be dithered is sent to the routine provided in this example. The values of the variables
RedValue, GreenValue, and BlueValue are generated by an application. In this example, the color
values are assumed to be in the range 0..255.
The given routine receives the color values and the X and Y window address (Xp and Yp) of the pixel.
The X and Y address is used to access the dither tables. The values from the dither tables are added to
the color values. After the dither addition, the resultant color values are quantized to three bits of red and
green and two bits of blue. The quantized results are packed into an 8-bit unsigned char and then stored
in the frame buffer. In the process of sending the contents of the frame buffer to the CRT, a special
section in the hardware then converts the frame buffer's 8-bit data into a 24-bit TrueColor data for
display.
Here is a routine that can be used to dither the 24-bit TrueColor data.
unsigned char dither_pixel_for_CR(RedValue,GreenValue,BlueValue,Xp,Yp)
int RedValue,GreenValueBlueValue,Xp,Yp;
{
static short dither_red[2][16] = {
{-16, 4, -1, 11,-14, 6, -3, 9,-15, 5, -2, 10,-13, 7, -4, 8},
{ 15, -5, 0,-12, 13, -7, 2,-10, 14, -6, 1,-11, 12, -8, 3, -9}};
static short dither_green[2][16] = {
{ 11,-15, 7, -3, 8,-14, 4, -2, 10,-16, 6, -4, 9,-13, 5, -1},
{-12, 14, -8, 2, -9, 13, -5, 1,-11, 15, -7, 3,-10, 12, -6, 0}};
static short dither_blue[2][16] = {
{ -3, 9,-13, 7, -1, 11,-15, 5, -4, 8,-14, 6, -2, 10,-16, 4},
{ 2,-10, 12, -8, 0,-12, 14, -6, 3, -9, 13, -7, 1,-11, 15, -5}};
int red, green, blue;
int x_dither_table, y_dither_table;
unsigned char pixel;
/* Determine the dither table entries to use based on the pixel address */
x_dither_table = Xp % 16; /* X Pixel Address MOD 16 */
Graphics Administration Guide for HP-UX 10.20
Page 65