N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## gDPSetKeyGB [macro]

Syntax

    #include "gbi.h"

    gDPSetKeyGB(Gfx *gdl,
       cG, sG, wG,
       cB, sB, wB)
    gsDPSetKeyGB(cG,
       sG, wG, cB,
       sB, wB)

Arguments

- gdl is the pointer to the graphics display list.

- color center (cB or cG) defines the intensity at which key is active (0-255).

- color scale (sB or sG) is (1.0/(size of soft edge))*255. The scale is in the range 0-255. For hard edge keying, set scale to 255

- color width (wB or wG) is (Size of half the key window including the soft edge)*scale. The width is expressed in a 12-bit 4.8 format. If the width is greater than 1.0, keying is disabled for that channel

Explanation
This macro selects the color for chroma key operation. Conceptually, the equation used for keying is:

key = clamp(0.0, -abs((X - center) * scale) + width, 1.0)

The alpha key is the minimum of KeyR, KeyG, or KeyB.

Notes
The red, green, and blue chroma key information is split into two separate macros simply because they do not all fit in one.

See Also
gDPSetCombineKey
gDPSetKeyR

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998-1999
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999