HP Visualize J5000 hp workstations - hp-ux 10.20 graphics administration guide - Page 65

HP_RGB_SMOOTH_MAP_LIST, X Pixel Address MOD 16

Page 65 highlights

_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 */ Page 65 Graphics Administration Guide for HP-UX 10.20

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171

_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