rgb2Xyz

Convert RGB input to XYZ.

Slice!(ReturnType*, 3)
rgb2Xyz
(
ReturnType = double
T
)
(
Slice!(T, 3) input
)

Examples

import std.math : approxEqual;

// dfmt off
Slice!(double*, 3) rgb = [
    1.0, 0.0, 0.0,
    0.0, 1.0, 0.0,
    0.0, 0.0, 1.0,
    0.470588, 0.470588, 0.470588
].sliced(4, 1, 3);

Slice!(double*, 3) xyz = [
    0.412456, 0.212673, 0.019334,
    0.357576, 0.715152, 0.119192,
    0.180438, 0.072175, 0.950304,
    0.178518, 0.187821, 0.204505
].sliced(4, 1, 3);
// dfmt on

assert(approxEqual(rgb.rgb2Xyz, xyz));

Meta