Skip to content

03 Additional parameters

tei187 edited this page Apr 23, 2024 · 3 revisions

Device independent - Illuminant chromaticity

There are different methods of setting the illuminant for our object:

  • use qualified standard illuminants names (as seen in Standard Illuminants chapter),

    use tei187\ColorTools\ColorModels\Lab;
    
    $lab = new Lab();
    $lab->setValues([ 63.12, -3.12, 3.31 ])
        ->setIlluminant('D50', 2);

    The setIlluminant() method will in this case verify if the passed arguments are known illuminant names and if values exist per passed standard observer angle.

  • passing xy chromaticity values of the white point

    use tei187\ColorTools\ColorModels\Lab;
    
    $lab = new Lab();
    $lab->setValues([ 63.12, -3.12, 3.31 ])
        ->setIlluminant([ 0.34567, 0.3585 ]);

    In this case setIlluminant() will directly assign passed values to the object.

Device dependent - RGB primaries

Before we jump into it, it is worth noting that RGB primaries are only relevant when converting to or from device independent models. Also, due to previously mentioned separation of device dependent and independent models (and conversion between them), RGB primaries should be set for RGB, HSL and HSV measures.

RGB primaries can be set through:

  • appropriate, qualified primaries name (as seen in RGB Primaries chapter),
    use tei187\ColorTools\ColorModels\RGB;
    
    $RGB = new RGB();
    $RGB->setValues("#c7fe00")
        ->setPrimaries('RadianceRGB');
  • a custom set of primaries.
    use tei187\ColorTools\ColorModels\RGB;
    use tei187\ColorTools\Conversion\RGBPrimaries\Custom as CustomPrimaries;
    
    # creating new primaries with:
    # - specified xyY values for each channel
    # - "My Primaries" name
    # - D55 standard illuminant
    # - 2.1 gamma
    $myPrimaries = new CustomPrimaries(
        [
            'R' => [ .648, .328, .212656 ],
            'G' => [ .309, .598, .715158 ],
            'B' => [ .157, .075, .072186 ]
        ], 
        "My Primaries", "D55", 2.1
    );
    
    $RGB = new RGB();
    $RGB->setValues("#c7fe00")
        ->setPrimaries($myPrimaries);