A SERVICE OF

logo

y_dither_table = Yp % 2; /* Y Pixel Address MOD 2 */
/* Start with the initial values as supplied by the calling routine */
red = RedValue;
green = GreenValue;
blue = BlueValue;
/* Generate the red dither value */
if (red >= 48) /* 48 is a constant required by this routine */
red=red-16;
else
red=red/2+8;
red += dither_red[y_dither_table][x_dither_table];
/* Check for overflow or underflow on red value */
if (red > 0xff) red = 0xff;
if (red < 0x00) red = 0x00;
/* Generate the green dither value */
if (green >= 48) /* 48 is a constant required by this routine */
green=green-16;
else
green=green/2+8;
green += dither_green[y_dither_table][x_dither_table];
/* Check for overflow or underflow on green value */
if (green > 0xff) green = 0xff;
if (green < 0x00) green = 0x00;
/* Generate the blue dither value */
if (blue >= 112) /* 112 is a constant required by this routine */
blue=blue-32;
else
blue=blue/2+24;
blue += (dither_blue[y_dither_table][x_dither_table]<<1);
/* Check for overflow or underflow on blue value */
if (blue > 0xff) blue = 0xff;
if (blue < 0x00) blue = 0x00;
pixel = ((red & 0xE0) | ((green & 0xE0) >> 3) | ((blue & 0xC0) >> 6));
return(pixel);
}
Graphics Administration Guide for HP-UX 10.20
Page 66