Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Module color

Module color 

Source
Expand description

RGB arithmetic with explicit rounding contracts.

Functions§

lerp_rgb
Interpolate using signed division toward zero. Clamp the numerator to the original denominator before replacing a zero divisor with one. Therefore a zero denominator always returns a, matching the caller contract.
lerp_rgb_q8
Q8 interpolation with arithmetic shift (rounding negative deltas down). t is a fraction over 256; 255 deliberately does not quite reach b.
scale_rgb
Scale each channel by a signed ratio, truncating toward zero, then clamp. den must be nonzero, each channel product must fit i32, and a product of i32::MIN must not be divided by -1.