Cmyk extends Model
in package
Com\Tecnick\Color\Model\Cmyk
CMYK Color Model class
Tags
Table of Contents
Methods
- __construct() : mixed
- Initialize a new color object.
- getArray() : array<string, float>
- Get an array with all color components
- getComponentsString() : string
- Get a space separated string with color component values.
- getCssColor() : string
- Get the CSS representation of the color: rgba(R, G, B, A) NOTE: Supported since CSS3 and above.
- getHexValue() : string
- Get the normalized hexadecimal value of the specified float fraction
- getJsPdfColor() : string
- Get the color format used in Acrobat JavaScript NOTE: the alpha channel is omitted from this representation unless is 0 = transparent
- getNormalizedArray() : array<string, float>
- Get an array with color components values normalized between 0 and $max.
- getNormalizedValue() : float
- Get the normalized integer value of the specified float fraction
- getPdfColor() : string
- Get the color components format used in PDF documents (CMYK) NOTE: the alpha channel is omitted
- getRgbaHexColor() : string
- Get the Hexadecimal representation of the color with alpha channel: #RRGGBBAA
- getRgbHexColor() : string
- Get the Hexadecimal representation of the color: #RRGGBB
- getType() : string
- Get the color model type (GRAY, RGB, HSL, CMYK)
- invertColor() : self
- Invert the color
- toCmykArray() : array<string, float>
- Get an array with CMYK color components
- toGrayArray() : array<string, float>
- Get an array with Gray color components
- toHslArray() : array<string, float>
- Get an array with HSL color components
- toRgbArray() : array<string, float>
- Get an array with RGB color components
Methods
__construct()
Initialize a new color object.
public __construct(array<string,
int|float|string> $components)
: mixed
Parameters
- $components : array<string, int|float|string>
-
color components.
getArray()
Get an array with all color components
public getArray()
: array<string,
float>
Return values
array<string, float> —with keys ('C', 'M', 'Y', 'K', 'A')
getComponentsString()
Get a space separated string with color component values.
public getComponentsString()
: string
Return values
stringgetCssColor()
Get the CSS representation of the color: rgba(R, G, B, A) NOTE: Supported since CSS3 and above.
public getCssColor()
: string
Use getHexadecimalColor() for CSS1 and CSS2
Return values
stringgetHexValue()
Get the normalized hexadecimal value of the specified float fraction
public getHexValue(float $value,
int $max)
: string
Parameters
- $value : float
-
Fraction value to convert [0..1]
- $max : int
-
Maximum value to return (reference value)
Return values
stringgetJsPdfColor()
Get the color format used in Acrobat JavaScript NOTE: the alpha channel is omitted from this representation unless is 0 = transparent
public getJsPdfColor()
: string
Return values
stringgetNormalizedArray()
Get an array with color components values normalized between 0 and $max.
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()
Get the normalized integer value of the specified float fraction
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]
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 = false
-
True for stroking (lines, drawing) and false for non-stroking (text and area filling).
Return values
stringgetRgbaHexColor()
Get the Hexadecimal representation of the color with alpha channel: #RRGGBBAA
public getRgbaHexColor()
: string
Return values
stringgetRgbHexColor()
Get the Hexadecimal representation of the color: #RRGGBB
public getRgbHexColor()
: string
Return values
stringgetType()
Get the color model type (GRAY, RGB, HSL, CMYK)
public getType()
: string
Return values
stringinvertColor()
Invert the color
public invertColor()
: self
Return values
selftoCmykArray()
Get an array with CMYK color components
public toCmykArray()
: array<string,
float>
Return values
array<string, float> —with keys ('cyan', 'magenta', 'yellow', 'key', 'alpha')
toGrayArray()
Get an array with Gray color components
public toGrayArray()
: array<string,
float>
Return values
array<string, float> —with keys ('gray')
toHslArray()
Get an array with HSL color components
public toHslArray()
: array<string,
float>
Return values
array<string, float> —with keys ('hue', 'saturation', 'lightness', 'alpha')
toRgbArray()
Get an array with RGB color components
public toRgbArray()
: array<string,
float>
Return values
array<string, float> —with keys ('red', 'green', 'blue', 'alpha')