Cmyk

CMYK Color Model class

Namespace: Com\Tecnick\Color\Model

class Cmyk extends Model

Extends: Model

Source: src/Model/Cmyk.php:34

CMYK Color Model class

Methods

__construct()

Initialize a new CMYK color object.

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

Parameters:

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

Throws:

Source: src/Model/Cmyk.php:68

getArray()

Get an array with all color components.

public getArray(): array<string,float>

Returns: array<string,float>: with keys (‘C’, ‘M’, ‘Y’, ‘K’, ‘A’)

Source: src/Model/Cmyk.php:83

getComponentsString()

Get a space separated string with color component values.

public getComponentsString(): string

Returns: string

Source: src/Model/Cmyk.php:179

getCssColor()

Get the CSS representation of the color: cmyk(C, M, Y, K) or cmyka(C, M, Y, K, A)

Components are emitted as percentages with up to 4 decimals.

public getCssColor(): string

Returns: string

Source: src/Model/Cmyk.php:138

getJsPdfColor()

Get the color format used in Acrobat JavaScript NOTE: the alpha channel is omitted from this representation unless it is 0 = transparent

public getJsPdfColor(): string

Returns: string

Source: src/Model/Cmyk.php:167

getNormalizedArray()

Get an array with color components values normalized between 0 and $max.

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

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

Parameters:

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

Returns: array<string,float>: with keys (‘C’, ‘M’, ‘Y’, ‘K’, ‘A’)

Source: src/Model/Cmyk.php:122

getPDFacArray()

Get an array with all color components for the PDF appearance characteristics dictionary.

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

public getPDFacArray(): float[]

Returns: float[]: DeviceCMYK color components (‘C’, ‘M’, ‘Y’, ‘K’)

Source: src/Model/Cmyk.php:104

getPdfColor()

Get the color components format used in PDF documents (CMYK) NOTE: the alpha channel is omitted

public getPdfColor(bool $stroke = false): string

Parameters:

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

Returns: string

Source: src/Model/Cmyk.php:190

invertColor()

Invert the color.

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

public invertColor(): static

Returns: static

Source: src/Model/Cmyk.php:266

toCmykArray()

Get an array with CMYK color components

public toCmykArray(): array<string,float>

Returns: array<string,float>: with keys (‘cyan’, ‘magenta’, ‘yellow’, ‘key’, ‘alpha’)

Source: src/Model/Cmyk.php:240

toGrayArray()

Get an array with Gray color components

public toGrayArray(): array<string,float>

Returns: array<string,float>: with keys (‘gray’, ‘alpha’)

Source: src/Model/Cmyk.php:205

toHslArray()

Get an array with HSL color components

public toHslArray(): array<string,float>

Returns: array<string,float>: with keys (‘hue’, ‘saturation’, ’lightness’, ‘alpha’)

Source: src/Model/Cmyk.php:230

toLabArray()

Get an array with Lab color components

public toLabArray(): array<string,float>

Returns: array<string,float>: with keys (’lstar’, ‘astar’, ‘bstar’, ‘alpha’)

Source: src/Model/Cmyk.php:256

toRgbArray()

Get an array with RGB color components

public toRgbArray(): array<string,float>

Returns: array<string,float>: with keys (‘red’, ‘green’, ‘blue’, ‘alpha’)

Source: src/Model/Cmyk.php:215

Inherited members

From Model

  • create(): Create a color model instance of the given type.
  • getHexValue(): Get the normalized hexadecimal value of the specified float fraction
  • getNormalizedValue(): Get the normalized integer value of the specified float fraction
  • getRgbaHexColor(): Get the Hexadecimal representation of the color with alpha channel: #RRGGBBAA
  • getRgbHexColor(): Get the Hexadecimal representation of the color: #RRGGBB
  • getType(): Get the color model type (GRAY, RGB, HSL, CMYK, LAB)
  • getTypeEnum(): Get the color model type as a backed enum case.
  • withInvertedColor(): Get a copy of the color, inverted.