Table of Contents Glide Programming Guide



Download 6.22 Mb.
Page54/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   50   51   52   53   54   55   56   57   ...   106
GLIDEPGM

4Chroma-keying


When chroma-keying is enabled, color values are compared to a global chroma-key reference value set by grChromakeyValue(). If the pixel’s color is the same as the chroma-key reference value, the pixel is discarded. The chroma-key comparison takes place before the color combine function; the other color selected by color combine function is the one compared (see grColorCombine() in Chapter Chapter 5. ). By default, chroma-keying is disabled.
Chroma-keying is useful for certain types of sprite animation or blue-screening of textures. Only one color value is reserved for chroma-keyed transparency, while alpha blending reserves a variable number of color bits for transparency.
void grChromakeyMode( GrChromakeyMode_t mode )

Use grChromakeyMode() to enable or disable chroma-keying. The argument, mode, specifies whether chroma-keying should enabled or disabled. Valid values are GR_CHROMAKEY_ENABLE and GR_CHROMAKEY_DISABLE.


void grChromakeyValue( GrColor_t value )

The function grChromakeyValue() sets the global chroma-key reference value as a packed RGBA value in the format specified in the cFormat parameter to grSstWinOpen() (see Chapter Chapter 3. ).


Example Special Effects.7 Simulating a blue-screen with chroma-keying.
A blue screen is a compositing mechanism used in live video where a second scene overlays all the “blue” pixels in the first scene. This technique is used to stand a weathercaster in front of a weather map, for example, and explains why they don’t wear blue suits or ties! With chroma-keying, pixels of any one specific color can be discarded, not just blue.
/* draw the background */
draw_weather_map();

/* enable chroma-keying */


grChromakeyMode(GR_CHROMAKEY_ENABLE);

/*set the reference color - assumes ARGB format */


grChromakeyValue(0xFF);

/* draw the inserted scene - most of it is blue */


draw_weatherman();


Download 6.22 Mb.

Share with your friends:
1   ...   50   51   52   53   54   55   56   57   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page