Function smol_rgb::encoded_to_linear[][src]

pub const fn encoded_to_linear(c: u8) -> f32

This function takes an encoded u8 and outputs a linear space (linear) sRgb f32.

This is based on https://bottosson.github.io/posts/colorwrong/ and similar transfer functions.

We do this with a LUT rather than actually calculate it, since it’s just faster to do an array lookup than do the math.

However, in the interest of simplicity, I have left the math which does the conversion commented within this function call, if you’re like to see the math.