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:
| Constant | Value | Description |
|---|---|---|
| BLEND_COLORADD | 1 | Add source and destination colors |
| BLEND_COLORMUL | 0 | Multiply source color (default) |
Alpha Blending
These constants control alpha (transparency) handling:
| Constant | Value | Description |
|---|---|---|
| BLEND_ALPHABLEND | 2 | Standard alpha blending |
| BLEND_ALPHAADD | 0 | Additive alpha (glowing effects) |
Z-Buffer
| Constant | Value | Description |
|---|---|---|
| BLEND_ZWRITE | 4 | Write to z-buffer |
| BLEND_NOZWRITE | 0 | Don'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.