PgGrayValue()

Extract color brightness

Synopsis:

int PgGrayValue( PgColor_t color );

Arguments:

color
A composite color value, of type PgColor_t.

Library:

ph

Description:

This macro converts a composite color into its corresponding level of gray. The calculation is based on 30% red, 59% green, and 11% blue, resulting in a value between 0 and 255.

Returns:

The gray component of the color.

Examples:

// Convert pal[i] into monochrome
pal[i] = PgGray( PgGrayValue( pal[i] ) );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgBlueValue(), PgCMY(), PgColor_t, PgGreenValue(), PgHSV(), PgRedValue(), PgRGB(), PgSetFillColor(), PgSetFillDither()

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