pub fn srgb_to_linear(c: f32) -> f32Expand description
Decode one sRGB-encoded channel in [0, 1] to linear light — the IEC
61966-2-1 transfer function, exactly.
This is the whole of what a [palette] stop goes through (ADR-0151). The
LUT holds light and the display write encodes it again on the way to 8-bit, so
a stop consumed raw arrives lifted: #c81423 renders #dd4c64, its green
channel nearly quadrupled. Applying the decode at the load boundary — where a
stop is validated, once per preset — leaves the LUT and every sample site
exactly as they were; the table is constant for its lifetime, so per-sample
decoding would buy nothing and cost the hot path.
Out-of-range input is clamped, so the function is total: the load boundary already rejects a non-finite channel and clamps the array form, and this makes the contract hold without depending on that.