GXSetBlendMode

C Specification

#include <revolution/gx.h>
void GXSetBlendMode( 
GXBlendMode    type,
GXBlendFactor  src_factor, 
GXBlendFactor  dst_factor, 
GXLogicOp      op );

Arguments

type the blend mode
Accepted values are:
Name Mode
GX_BM_NONE performs neither blending nor logical processing
GX_BM_BLEND blending mode
GX_BM_LOGIC logical processing mode
GX_BM_SUBTRACT subtraction processing mode
src_factor input coefficient
The pixel color created by the graphics processor is multiplied by this coefficient. Acceptable values are as follows:
Name Description
GX_BL_ZERO 0.0
GX_BL_ONE 1.0
GX_BL_DSTCLR the frame buffer color
GX_BL_INVDSTCLR 1.0 - (the frame buffer color)
GX_BL_SRCALPHA the source alpha
GX_BL_INVSRCALPHA 1.0 - (the source alpha)
GX_BL_DSTALPHA the frame buffer alpha
GX_BL_INVDSTALPHA 1.0 - (the frame buffer alpha)
This coefficient works only when type is GX_BM_BLEND.
dst_factor the output coefficient
The current frame buffer pixel color is multiplied by this coefficient. Acceptable values are as follows:
Name Description
GX_BL_ZERO 0.0
GX_BL_ONE 1.0
GX_BL_SRCCLR source color
GX_BL_INVSRCCLR 1.0 - (the source color)
GX_BL_SRCALPHA the source alpha
GX_BL_INVSRCALPHA 1.0 - (the source alpha)
GX_BL_DSTALPHA the frame buffer alpha
GX_BL_INVDSTALPHA 1.0 - (the frame buffer alpha)
This coefficient works only when type is GX_BM_BLEND.
op blend processing
The acceptable values and logical operations are as follows:
Name Bit Operations as Expressed in C
GX_LO_CLEAR dst = 0
GX_LO_SET dst = 1
GX_LO_COPY dst = src
GX_LO_INVCOPY dst = ~src
GX_LO_NOOP dst = dst
GX_LO_INV dst = ~dst
GX_LO_AND dst = src & dst
GX_LO_NAND dst = ~(src & dst)
GX_LO_OR dst = src | dst
GX_LO_NOR dst = ~(src | dst)
GX_LO_XOR dst = src ^ dst
GX_LO_EQUIV dst = ~(src ^ dst)
GX_LO_REVAND dst = src & ~dst
GX_LO_INVAND dst = ~src & dst
GX_LO_REVOR dst = src | ~dst
GX_LO_INVOR dst = ~src | dest
This coefficient only functions when type is GX_BM_LOGIC.

Return Values

None.

Description

This function determines how the source image, generated by the graphics processor, is blended with the embedded frame buffer (EFB). Be aware that color updates are be enabled by calling GXSetColorUpdate. When type is set to GX_BM_NONE, the source data is written directly to the EFB. When type is set to GX_BM_BLEND, the source and EFB pixels are blended using the following formulae.

dst_pix_clr = src_pix_clr * src_factor + dst_pix_clr * dst_factor

The GX_BL_DSTALPHA / GX_BL_INVDSTALPHA can be used only when the EFB is set to the GX_PF_RGBA6_Z24 pixel format (see GXSetPixelFmt). If the pixel format is GX_PF_RGBA6_Z24 then src_factor and dst_factor are also applied to the alpha channel. To write the alpha channel to the EFB you must call GXSetAlphaUpdate.

When type is set to GX_BM_LOGIC, the source and EFB pixels are blended using logical bitwise operations. You can't use both blending and logic operations at the same time.

See Also

GXSetPixelFmt
GXSetZMode
GXSetColorUpdate
GXSetAlphaUpdate

Revision History

03/01/2006 Initial version.