GXSetBlendMode

Syntax

#include <revolution/gx.h>

void GXSetBlendMode( 
    GXBlendMode    type,
    GXBlendFactor  src_factor, 
    GXBlendFactor  dst_factor, 
    GXLogicOp      op );

Arguments

type 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 Frame buffer color.
GX_BL_INVDSTCLR 1.0 - (frame buffer color)
GX_BL_SRCALPHA Source alpha.
GX_BL_INVSRCALPHA 1.0 - (source alpha)
GX_BL_DSTALPHA Frame buffer alpha.
GX_BL_INVDSTALPHA 1.0 - (frame buffer alpha)
This coefficient works only when type is GX_BM_BLEND.
dst_factor 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 - (source color)
GX_BL_SRCALPHA Source alpha.
GX_BL_INVSRCALPHA 1.0 - (source alpha)
GX_BL_DSTALPHA Frame buffer alpha.
GX_BL_INVDSTALPHA 1.0 - (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 you must call the GXSetColorUpdate function to update colors. 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 formula:

dst_pix_clr = src_pix_clr * src_factor + dst_pix_clr * dst_factor

GX_BL_DSTALPHA and GX_BL_INVDSTALPHA can be used only when the EFB is set to the GX_PF_RGBA6_Z24 pixel format (see the GXSetPixelFmt function). 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 the GXSetAlphaUpdate function.

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

See Also

GXSetPixelFmt, GXSetZMode, GXSetColorUpdate, GXSetAlphaUpdate

Revision History

2006/03/01 Initial version.


CONFIDENTIAL