Composite color value
unsigned long PgColor_t;
The PgColor_t type definition describes a composite color value. The interpretation of the color depends on the current color model, which you can set by calling PgSetColorModel().
The color models are:
Reserved | Red | Green | Blue |
---|---|---|---|
0000 0000 | rrrr rrrr | gggg gggg | bbbb bbbb |
If the destination draw context (default, offscreen context, etc.) has enough room to hold the alpha channel after color conversion, the alpha channel is written in with the color information when writing the pixel into memory. For example:
PgSetFillColor(0x80FFFFFF); PgDrawIRect(0,0,99,99,Pg_DRAW_FILL); PgSetFillColor(0x40FFFFFF); PgDrawIRect(100,0,199,99,Pg_DRAW_FILL); PgSetFillColor(0xC0FFFFFF); PgDrawIRect(200,0,299,99,Pg_DRAW_FILL);
If the current mode of the destination draw context is 32-bit ARGB, the complete values are written to the pixel RAM.
If the destination draw context is 1555 (1 bit alpha, 5 bits red, 5 bits green, 5 bits blue), the first rectangle is 0xFFFF, the second is 0x7FFF and the third is 0xFFFF. Note that the second rectangle's alpha value is 0 (there's only 1 bit for alpha in this mode), so 0 through 0x7F convert to 0 and 0x80 through 0xff convert to 1.
If the destination draw context is 565 or 888 mode then the alpha channel information is lost, as there is no alpha channel.
At least the following colors are defined in <photon/Pg.h>:
Pg_BLACK
Pg_DGRAY
Pg_MGRAY
Pg_GRAY
Pg_WHITE
Pg_RED
Pg_GREEN
Pg_BLUE
Pg_YELLOW
Pg_MAGENTA
Pg_CYAN
Pg_DGREEN
Pg_DCYAN
Pg_DBLUE
Pg_BROWN
Pg_PURPLE
Pg_CELIDON
We've defined the following colors for compatibility with standard VGA colors:
Pg_VGA0
Pg_VGA1
Pg_VGA2
Pg_VGA3
Pg_VGA4
Pg_VGA5
Pg_VGA6
Pg_VGA7
Pg_VGA8
Pg_VGA9
Pg_VGAA
Pg_VGAB
Pg_VGAC
Pg_VGAD
Pg_VGAE
Pg_VGAF
Here are samples of the standard colors:
We've also defined the following in <photon/Pg.h>:
These colors work only in Pg_CM_PRGB or Pg_CM_RGB mode. |
This facility depends on the video hardware, and behaves differently depending on the graphics driver. |
Photon
PgAlphaValue(), PgARGB(), PgBlueValue(), PgCMY(), PgColorHSV_t, PgGetColorModel(), PgGreenValue(), PgHSV2RGB(), PgRedValue(), PgRGB(), PgRGB2HSV(), PgSetColorModel(), PgSetFillColor(), PgSetFillDither(), PgSetStrokeColor(), PgSetStrokeDither(), PgSetTextColor(), PgSetTextDither()
“Color” in the Raw Drawing and Animation chapter of the Photon Programmer's Guide