Table of contents
Namespace: Com\Tecnick\Color\Model
class Gray extends Model
Extends: Model
Source: src/Model/Gray.php:34
Gray Color Model class
Methods
__construct()
Initialize a new Gray 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:
- UnknownComponentException: if a component name is not defined by this model
Source: src/Model/Gray.php:53
getArray()
Get an array with all color components.
public getArray(): array<string,float>
Returns: array<string,float>: with keys (‘G’, ‘A’)
Source: src/Model/Gray.php:65
getComponentsString()
Get a space separated string with color component values.
public getComponentsString(): string
Returns: string
Source: src/Model/Gray.php:137
getCssColor()
Get the CSS representation of the color: g(G) or rgba(R, G, B, A).
The gray level is emitted as an integer in [0..255].
public getCssColor(): string
Returns: string
Source: src/Model/Gray.php:111
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/Gray.php:125
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)
Returns: array<string,float>: with keys (‘G’, ‘A’)
Source: src/Model/Gray.php:98
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: 1 = DeviceGray
public getPDFacArray(): float[]
Returns: float[]: DeviceGray color component (‘G’)
Source: src/Model/Gray.php:83
getPdfColor()
Get the color components format used in PDF documents (G) 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/Gray.php:148
invertColor()
Invert the color
public invertColor(): static
Returns: static
Source: src/Model/Gray.php:224
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/Gray.php:206
toGrayArray()
Get an array with Gray color components
public toGrayArray(): array<string,float>
Returns: array<string,float>: with keys (‘gray’, ‘alpha’)
Source: src/Model/Gray.php:163
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/Gray.php:191
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/Gray.php:216
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/Gray.php:176
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.