Function tryToSRgb8

Tries to quantize normalized encoded sRGB into SRgb8.

bool tryToSRgb8(T)(
  SRgb!T value,
  ref SRgb8 output
) pure nothrow @nogc @safe;

All three source components must be finite values in inclusive [0, 1]. Values outside that domain, NaN, and infinities are rejected. No clipping or gamut mapping occurs.

Quantization rounds to the nearest byte; exact half steps choose the larger byte. The endpoints map exactly: 0 maps to 0 and 1 maps to 255.

Parameters

NameDescription
value Normalized computational encoded-sRGB value.
output Destination storage value. It is unchanged on failure.

Returns

true when all components were stored; otherwise false.