Module color.cvd
Model-specific color-vision-deficiency transformations in linear-light sRGB.
The transformations in this module are mathematical display-simulation primitives. They do not classify accessibility, choose consumer thresholds, clip or gamut-map their results, or alter alpha.
Brettel 1997 is exposed for protan, deutan, and tritan dichromacy. Viénot 1999 is exposed only for protan and deutan, matching the validated display model boundary. Machado 2009 is exposed for protan and deutan with its own 0..1 severity semantics; the published tritan table is deliberately not promoted because the research evidence does not support presenting it as an equally validated tritan model.
All transforms operate on LinearSRgb!T. Callers starting from encoded sRGB
must decode explicitly with toLinear, and may encode explicitly with
toSRgb afterwards.
The scalar callables are convenient for isolated colors. Repeated work can
prepare the selected model once and then reuse the resulting value through
transform, fixed-cardinality transformInto, or runtime-sized tryTransformInto
without allocation.
Functions
| Name | Description |
|---|---|
brettel1997Dichromat(color, deficiency)
|
Applies the Brettel, Viénot & Mollon (1997) full-dichromat transform. |
machado2009(color, deficiency, severity)
|
Applies the Machado, Oliveira & Fernandes (2009) severity-dependent CVD model for protan or deutan deficiency. |
prepareBrettel1997Dichromat(deficiency)
|
Prepares one Brettel 1997 full-dichromat transform for repeated use. |
prepareMachado2009(deficiency, severity)
|
Prepares a Machado 2009 transform with a typed public result. |
prepareVienot1999Dichromat(deficiency)
|
Prepares one Viénot 1999 protan/deutan transform for repeated use. |
tryPrepareMachado2009(deficiency, severity, prepared)
|
Prepares a Machado 2009 protan/deutan transform for repeated use. |
vienot1999Dichromat(color, deficiency)
|
Applies the Viénot, Brettel & Mollon (1999) full-deficiency display transform for protan or deutan dichromacy. |
Structs
| Name | Description |
|---|---|
PreparedBrettel1997Dichromat
|
Prepared Brettel 1997 full-dichromat transform for repeated application. |
PreparedMachado2009
|
Prepared Machado 2009 protan/deutan transform for repeated application. |
PreparedVienot1999Dichromat
|
Prepared Viénot 1999 protan/deutan transform for repeated application. |
Enums
| Name | Description |
|---|---|
CvdDeficiency
|
Cone-deficiency families supported by the Brettel 1997 dichromat model. |
CvdPreparationError
|
Errors returned by Result-based CVD preparation. |
RedGreenCvdDeficiency
|
Red/green cone-deficiency families supported by the promoted Viénot 1999 and Machado 2009 operations. |