Function toLinear

Decodes an sRGB value for calculations that require linear light.

LinearSRgb!T toLinear(T)(
  SRgb!T color
) pure nothrow @nogc @safe;

Components outside the nominal [0, 1] range remain extended values rather than being clipped. Negative values use a sign-preserving extension of the sRGB transfer function.

Parameters

NameDescription
color Encoded sRGB value to decode.

Returns

The corresponding linear-light sRGB value.

Standards

The nominal transfer follows the sRGB transfer model used by W3C CSS Color Module Level 4; color-d extends it sign-preservingly outside the nominal display range.

See Also

toSRgb

Example

const encoded = SRgbd(1.0, 0.0, -1.0);
const linear = encoded.toLinear;

assert(linear == LinearSRgbd(1.0, 0.0, -1.0));