Function machado2009
Applies the Machado, Oliveira & Fernandes (2009) severity-dependent CVD model for protan or deutan deficiency.
LinearSRgb!T machado2009(T)(
LinearSRgb!T color,
RedGreenCvdDeficiency deficiency,
T severity
) pure nothrow @nogc @safe;
Severity is specific to this model: 0 is the identity endpoint, 1 is the full-deficiency endpoint, and intermediate values interpolate only between adjacent published 0.1 reference matrices. It is not a generic CVD severity parameter.
Severity must be finite and in [0, 1]. Invalid severity is reported by
returning LinearSRgb!T, whose components are NaN; the value is not
silently clamped or normalized.
The transform preserves extended color components and performs no clipping or gamut mapping. NaN and infinity in the input remain visible through ordinary IEEE arithmetic.
The published Machado tritan table is deliberately not exposed by this production callable because the retained research identifies a material limitation for tritanopia/tritanomaly.
Parameters
| Name | Description |
|---|---|
| color | Linear-light sRGB value to transform. |
| deficiency | Protan or deutan family. |
| severity | Machado-model severity from 0 through 1 inclusive. |
Returns
The transformed linear-light sRGB value, or the natural invalid
LinearSRgb!T value for invalid severity.
Repeated Use
Prefer tryPrepareMachado2009 when applying one deficiency/severity
pair to multiple colors.
Standards
Machado, Oliveira & Fernandes (2009), using the cross-source-verified eleven-point reference matrix tables.
Example
enum input = LinearSRgbd(0.2, 0.4, 0.7);
enum half =
input .machado2009(
RedGreenCvdDeficiency .protan,
0.5
);
static assert(
half .r > 0.267093 &&
half .r < 0.267096
);
static assert(
half .g > 0.399712 &&
half .g < 0.399715
);
static assert(
half .b > 0.708788 &&
half .b < 0.708791
);
enum identity =
input .machado2009(
RedGreenCvdDeficiency .deutan,
0.0
);
static assert(identity == input);