Cmyk

CMYK Color Model class

Namespace: Com\Tecnick\Color\Model

Extends: Model

File: Cmyk.php line 34

CMYK Color Model class

Tags

Methods

__construct()

File: Cmyk.php line 68

public __construct(array<string, int|float|string> $components) : mixed

Parameters

  • $components : array<string, int|float|string>: Color components, each clamped to [0..1].

Tags

create()

File: Model.php line 76

public static create(ColorModelType|string $type[, array<string, int|float|string> $components = [] ]) : self

Parameters

  • $type : ColorModelType|string: Color model type.
  • $components : array<string, int|float|string> = []: Color components.

Tags

Return values

self

getArray()

File: Cmyk.php line 83

public getArray() : array<string, float>

Return values

array<string, float> —

with keys (‘C’, ‘M’, ‘Y’, ‘K’, ‘A’)

getComponentsString()

File: Cmyk.php line 179

public getComponentsString() : string

Return values

string

getCssColor()

File: Cmyk.php line 138

public getCssColor() : string

Components are emitted as percentages with up to 4 decimals.

Return values

string

getHexValue()

File: Model.php line 401

public getHexValue(float $value, int $max) : string

The result is zero-padded to 2 digits.

Parameters

  • $value : float: Fraction value to convert [0..1]
  • $max : int: Maximum value to return (reference value) [0..255]

Return values

string

getJsPdfColor()

File: Cmyk.php line 167

public getJsPdfColor() : string

Return values

string

getNormalizedArray()

File: Cmyk.php line 122

public getNormalizedArray(int $max) : array<string, float>

NOTE: the alpha and other fraction component values are kept in the [0..1] range.

Parameters

  • $max : int: Maximum value to return (reference value - it should be 100)

Return values

array<string, float> —

with keys (‘C’, ‘M’, ‘Y’, ‘K’, ‘A’)

getNormalizedValue()

File: Model.php line 361

public getNormalizedValue(float $value, int $max) : float

Parameters

  • $value : float: Fraction value to convert [0..1]
  • $max : int: Maximum value to return (reference value)

Return values

float —

value [0..$max]

getPDFacArray()

File: Cmyk.php line 104

public getPDFacArray() : array<string|int, float>

The values are in the range 0.0 to 1.0 and the number of array elements determines the color space: 4 = DeviceCMYK

Return values

array<string|int, float> —

DeviceCMYK color components (‘C’, ‘M’, ‘Y’, ‘K’)

getPdfColor()

File: Cmyk.php line 190

public getPdfColor([bool $stroke = false ]) : string

Parameters

  • $stroke : bool = false: True for stroking (lines, drawing) and false for non-stroking (text and area filling).

Return values

string

getRgbaHexColor()

File: Model.php line 409

public getRgbaHexColor() : string

Return values

string

getRgbHexColor()

File: Model.php line 434

public getRgbHexColor() : string

Return values

string

getType()

File: Model.php line 338

public getType() : string

Return values

string

getTypeEnum()

File: Model.php line 348

public getTypeEnum() : ColorModelType

Tags

  • throws: Exception if the model declares an unknown type

Return values

ColorModelType

invertColor()

File: Cmyk.php line 266

public invertColor() : static

Inversion is the RGB complement (1 - component), computed through RGB.

Return values

static

toCmykArray()

File: Cmyk.php line 240

public toCmykArray() : array<string, float>

Return values

array<string, float> —

with keys (‘cyan’, ‘magenta’, ‘yellow’, ‘key’, ‘alpha’)

toGrayArray()

File: Cmyk.php line 205

public toGrayArray() : array<string, float>

Return values

array<string, float> —

with keys (‘gray’, ‘alpha’)

toHslArray()

File: Cmyk.php line 230

public toHslArray() : array<string, float>

Return values

array<string, float> —

with keys (‘hue’, ‘saturation’, ’lightness’, ‘alpha’)

toLabArray()

File: Cmyk.php line 256

public toLabArray() : array<string, float>

Return values

array<string, float> —

with keys (’lstar’, ‘astar’, ‘bstar’, ‘alpha’)

toRgbArray()

File: Cmyk.php line 215

public toRgbArray() : array<string, float>

Return values

array<string, float> —

with keys (‘red’, ‘green’, ‘blue’, ‘alpha’)

withInvertedColor()

File: Model.php line 426

public withInvertedColor() : static

The receiver is left untouched, unlike invertColor().

Return values

static