Function tryToSRgba8

Tries to quantize normalized straight-alpha encoded sRGB into SRgba8.

bool tryToSRgba8(T)(
  Alpha!(SRgb!T) value,
  ref SRgba8 output
) pure nothrow @nogc @safe;

RGB and alpha must all be finite values in inclusive [0, 1]. Failure does not clip, premultiply, repair special values, or modify the destination. RGB is quantized independently from straight alpha.

Quantization rounds to the nearest byte; exact half steps choose the larger byte.

Parameters

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

Returns

true when RGB and alpha were stored; otherwise false.