Function toXyzD65

Converts linear-light sRGB to CIE XYZ D65.

XyzD65!T toXyzD65(T)(
  LinearSRgb!T rgb
) pure nothrow @nogc @safe;

Use this conversion when an operation needs XYZ D65 coordinates. Extended values are transformed without gamut clipping. Extremely large component magnitudes can produce non-finite results.

Parameters

NameDescription
rgb Linear-light sRGB value to convert.

Returns

The corresponding CIE XYZ D65 value.

Standards

Uses the high-precision sRGB/D65 linear transformation represented by the W3C CSS Color Module Level 4 reference matrix.

See Also

toLinearSRgb

Example

import std.math : fabs;

const rgb = LinearSRgbd(0.25, 0.50, 0.75);
const roundTrip = rgb.toXyzD65.toLinearSRgb;

assert(fabs(roundTrip.r - rgb.r) < 1e-12);
assert(fabs(roundTrip.g - rgb.g) < 1e-12);
assert(fabs(roundTrip.b - rgb.b) < 1e-12);