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).
tis a fraction over 256; 255 deliberately does not quite reachb. - scale_
rgb - Scale each channel by a signed ratio, truncating toward zero, then clamp.
denmust be nonzero, each channel product must fiti32, and a product ofi32::MINmust not be divided by -1.