Blend Mode Constants

Constants for sprite and graphics blending operations.

Overview

Blend mode constants control how sprites and graphics are combined with the existing frame buffer content. They're used with hgeSprite::SetBlendMode() and graphics functions.

Color Blending

These constants control how the sprite's color is combined with the destination:

ConstantValueDescription
BLEND_COLORADD1Add source and destination colors
BLEND_COLORMUL0Multiply source color (default)

Alpha Blending

These constants control alpha (transparency) handling:

ConstantValueDescription
BLEND_ALPHABLEND2Standard alpha blending
BLEND_ALPHAADD0Additive alpha (glowing effects)

Z-Buffer

ConstantValueDescription
BLEND_ZWRITE4Write to z-buffer
BLEND_NOZWRITE0Don't write to z-buffer (default)

Common Combinations

Standard Alpha Blending

The most common blend mode for sprites with transparency:

sprite->SetBlendMode(BLEND_COLORMUL | BLEND_ALPHABLEND);

Additive Blending

For glowing effects like fire, magic, and explosions:

sprite->SetBlendMode(BLEND_COLORMUL | BLEND_ALPHAADD);

Color Addition

For brightening effects:

sprite->SetBlendMode(BLEND_COLORADD | BLEND_ALPHABLEND);

Default Blend Mode

The default blend mode for new sprites is:

BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_NOZWRITE

Visual Examples

ALPHABLEND — Standard transparency. Sprite colors replace background proportionally to alpha.

ALPHAADD — Colors are added together. Black pixels are invisible, white pixels brighten everything beneath.

See Also