Convert hue, saturation, and value to composite color format
PgColor_t PgHSV( unsigned H, int S, int V );
This function converts hue, saturation, and value into a PgColor_t structure.
A color circle is divided into 65536 gradations (called binary gradations or bi-grads). Hue is in bi-grads, starting with red at 0 (0 degrees), green at 0x5555 (120 degrees), and blue at 0xAAAA (240 degrees):
Hue | Color |
---|---|
0x0000 | Red |
0x2AAA | Yellow |
0x5555 | Green |
0x8000 | Cyan |
0xAAAA | Blue |
0xD555 | Magenta |
0xFFFF | Almost red |
The values for saturation and value range from 0 to 255:
Saturation | Effect |
---|---|
0 | Gray |
128 | Muted |
255 | Pure color |
Value | Effect |
---|---|
0 | Black |
128 | Dark |
255 | Full brightness |
A composite color value.
Color | HSV value |
---|---|
Black | PgHSV( 0, 0, 0 ); |
White | PgHSV( 0, 0, 255 ); |
Red | PgHSV( 0, 255, 255 ); |
Green | PgHSV( 0x5555, 255, 255 ); |
Blue | PgHSV( 0xAAAA, 255, 255 ); |
Orange | PgHSV( 0x1400, 255, 255 ); |
Slate Blue | PgHSV( 0xA000, 121, 134 ); |
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PgBlueValue(), PgCMY(), PgGreenValue(), PgHSV2RGB(), PgRedValue(), PgRGB(), PgRGB2HSV(), PgSetFillColor(), PgSetFillDither()