ColorFromSDL
ColorFromSDL (c: sdl2.Color) -> Color
Internal function that converts SDL2's Color data structure to Magma's Color data structure.
Parameters:
- c: the SDL2 Color data structure
Returns: Magma's Color data structure
ColorToSDL
ColorToSDL (c: Color) -> sdl2
Internal function that converts Magma's Color data structure to SDL2's Color data structure.
Parameters:
- c: the Magma Color data structure
Returns: SDL2's Color data structure
ColorAdd
ColorAdd (a, b: Color) -> Color
Performs per-channel addition of two Colors.
Parameters:
- a: first Color operand
- b: second Color operand
Returns: Resulting Color after addition
ColorSub
ColorSub (a, b: Color) -> Color
Performs per-channel subtraction of two Colors.
Parameters:
- a: first Color operand
- b: second Color operand
Returns: Resulting Color after subtraction
ColorMul
ColorMul (a, b: Color) -> Color
Performs per-channel multiplication of two Colors, clamped to valid RGBA ranges. The alpha channel is clamped to a maximum of 100 to avoid full opacity.
Parameters:
- a: first Color operand
- b: second Color operand
Returns: Resulting Color after multiplication and clamping
ColorDiv
ColorDiv (a, b: Color) -> Color
Performs per-channel division of two Colors, with float casting for precision. The result is clamped to valid RGBA ranges, with alpha clamped to 100 max.
Parameters:
- a: numerator Color
- b: denominator Color
Returns: Resulting Color after division and clamping
ColorNegate
ColorNegate (a: Color) -> Color
Returns the color negation (inversion) of the RGB channels. Note: this operation is not performed using SIMD intrinsics directly.
Parameters:
- a: Color to negate
Returns: Negated Color with clamped alpha
ColorToArray
ColorToArray (color: Color)
Converts a color to an array
Parameters:
- color: The color to convert to an array
Returns: an u8 array of four values in the format (R, G, B, A)