PgSetChroma(), PgSetChromaCx()

Set the chroma color and operation

Synopsis:

void PgSetChroma( PgColor_t ChromaColor,
                  unsigned long ChromaOp );

void PgSetChromaCx( PhGC_t *gc,
                    PgColor_t ChromaColor,
                    unsigned long ChromaOp );

Library:

ph

Description:

These functions set the current chroma color and defines the chroma operation.

PgSetChroma() works on the current graphics context, while you can specify the graphics context gc for PgSetChromaCx().

ChromaColor is the color to test against for chroma operations. ChromaOp is made up of the following bits:

Pg_CHROMA_SRC_MATCH
Test against the source data.
Pg_CHROMA_DEST_MATCH
Test against the destination data.
Pg_CHROMA_DRAW
If the test pixel matches the chroma color, draw it in the destination.
Pg_CHROMA_NODRAW
If the test pixel matches the chroma color, don't draw it in the destination.

Examples:

// Draw an image using a chroma color of full green

PhImage_t *image;
PhPoint_t p={0,0};

// Code to load the image...
   …

PgChromaOn();
// Set the chroma operation to copy every pixel in the source to
// the destination, except the color 0x0000FF00 (bright green)
PgSetChroma(0x0000FF00, Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW);
PgDrawPhImagemx(&p,image,0);
PgChromaOff();
PgFlush();

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgChromaOff*(), PgChromaOn*(), PgColor_t,

Chroma key support in the Raw Drawing and Animation chapter of the Photon Programmer's Guide