Skip to content

X01 Getters and setters

tei187 edited this page May 2, 2023 · 1 revision

Each of the model objects have specified shared getters and setters.

All models

Getters

Illuminant scope

  • getIlluminantAngle() returns the angle of currently set illuminant.
  • getIlluminantXY() returns the x,y coordinates of currently set illuminant's chromaticity.
  • getIlluminantTristimulus() returns the XYZ tristimulus values, based on currently set illuminant's chromaticity coordinates.
  • getIlluminantName() returns the name of currently set illuminant (if applicable).

Values scope

  • getAdaptedValues() returns object that underwent chromatic adaptation transformation to specified parameters (destination illuminant and CAT matrix).
  • getContrast() returns color contrast based on current object's values and reference object's values.
  • getMeasureType() returns name of the color model.
  • getTemperature() returns calculated temperature in Kelvin degrees.
  • getValues() returns currently assigned color values of the object.

Setters

  • setIlluminant() sets illuminant per passed arguments (xy chromaticity coordinates, standard observer angle). IMPORTANT: this should not be used on device dependent models, since such data should only come through RGB primaries.
  • setIlluminantName() sets illuminant's name.
  • setIlluminantTristimulus() sets XYZ tristimulus values for specified illuminant. IMPORTANT: it does not rebase the xy chromaticity coordinates values, best not to use without proper checks.
  • setValues() sets values per model requirements.

Device dependent models

Device dependent models have some additonal methods:

Getters

  • getPrimaries() returns an object with primaries.
  • (RGB) getValuesHex() returns values in hex form, depending on bool switch as an array or string.
  • (RGB) getValuesFF() returns values in 0-255 form as an array.
  • (RGB/HSL) getValuesString() returns values in 0-255 form as a string (rgb(RRR,GGG,BBB) or rgb(HHH,SSS,LLL)).
  • (HSL/HSV) getValuesFormatted() returns formatted values (with degree and percentage signs) as an array of strings.

Setters

  • setPrimaries() sets primaries per qualified RGB primaries name or object based on primaries interface.