PgHSV()

Convert hue, saturation, and value to composite color format

Synopsis:

PgColor_t PgHSV( unsigned H, int S, int V );

Library:

ph

Description:

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

Returns:

A composite color value.

Examples:

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 );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgBlueValue(), PgCMY(), PgColor_t, PgGreenValue(), PgHSV2RGB(), PgRedValue(), PgRGB(), PgRGB2HSV(), PgSetFillColor(), PgSetFillDither()

Color in the Raw Drawing and Animation chapter of the Photon Programmer's Guide