OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
colormath.h
Go to the documentation of this file.
1
52
53#ifndef OPENSNES_COLORMATH_H
54#define OPENSNES_COLORMATH_H
55
56#include <snes/types.h>
57#include <snes/registers.h> /* REG_CGWSEL / REG_CGADSUB / REG_COLDATA */
58
59/* Removed on 2026-10-05 (1.0 plan, lot C): colorMathEnable.
60 * The replacements are in docs/UPGRADING.md; `make check-upgrade` names them. */
61
62/*============================================================================
63 * Layer Masks (for colorMathSetLayers)
64 *============================================================================*/
65
66/* The layers are named by LAYER_BG1..LAYER_BG4 and LAYER_OBJ (video.h), the
67 * same bits everywhere a call takes a set of layers. The backdrop is the one
68 * bit only color math has. */
69
71#define COLORMATH_BACKDROP BIT(5)
72
74#define COLORMATH_ALL 0x3F
75
76/* COLORMATH_BG1..COLORMATH_BG4 and COLORMATH_OBJ were removed on 2026-10-05: use
77 * LAYER_BG1..LAYER_OBJ (video.h), the same values (docs/UPGRADING.md). */
78
79/*============================================================================
80 * Color Math Operations
81 *============================================================================*/
82
84#define COLORMATH_ADD 0
85
87#define COLORMATH_SUB 1
88
89/*============================================================================
90 * Color Math Source
91 *============================================================================*/
92
94#define COLORMATH_SRC_SUBSCREEN 0
95
97#define COLORMATH_SRC_FIXED 1
98
99/*============================================================================
100 * Color Math Enable Conditions
101 *============================================================================*/
102
104#define COLORMATH_ALWAYS 0
105
107#define COLORMATH_INSIDE 1
108
110#define COLORMATH_OUTSIDE 2
111
113#define COLORMATH_NEVER 3
114
115/*============================================================================
116 * Fixed Color Channel Masks
117 *============================================================================*/
118
120#define COLDATA_RED 0x20
121
123#define COLDATA_GREEN 0x40
124
126#define COLDATA_BLUE 0x80
127
129#define COLDATA_ALL (COLDATA_RED | COLDATA_GREEN | COLDATA_BLUE)
130
131/*============================================================================
132 * Core Color Math Functions
133 *============================================================================*/
134
140void colorMathInit(void);
141
153
158
165
178void colorMathSetHalf(u8 enable);
179
188
194void colorMathSetCondition(u8 condition);
195
217
228
235void colorMathSetChannel(u8 channel, u8 intensity);
236
237/*============================================================================
238 * Color Math Effect Helpers
239 *============================================================================*/
240
252
261void colorMathShadow(u8 layers, u8 intensity);
262
273void colorMathTint(u8 layers, u8 r, u8 g, u8 b);
274
283void colorMathSetBrightness(u8 brightness);
284
285#endif /* OPENSNES_COLORMATH_H */
void colorMathSetCondition(u8 condition)
Set when color math is enabled (window control).
void colorMathShadow(u8 layers, u8 intensity)
Set up shadow/darkening effect.
void colorMathTransparency50(u8 layers)
Set up 50% transparency for layers.
void colorMathSetBrightness(u8 brightness)
Set brightness for fade effects.
void colorMathSetFixedColor(u8 r, u8 g, u8 b)
Set fixed color for blending.
void colorMathSetHalf(u8 enable)
Enable or disable half mode.
void colorMathSetOp(u8 op)
Set color math operation (add or subtract).
void colorMathTint(u8 layers, u8 r, u8 g, u8 b)
Set up color tint effect.
void colorMathDisable(void)
Disable all color math.
void colorMathInit(void)
Initialize color math to defaults.
void colorMathSetDirectColor(u8 enable)
Enable or disable direct color mode (CGWSEL bit 0).
void colorMathSetLayers(u8 layers)
Set the layers colour math applies to — REPLACES the previous set.
void colorMathSetSource(u8 source)
Set color math source.
void colorMathSetChannel(u8 channel, u8 intensity)
Set a single fixed color channel.
static u16 b
Definition main.c:156
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition types.h:47
SNES Hardware Register Definitions.
OpenSNES Standard Types.