Gray

Gray Color Model class

Namespace: Com\Tecnick\Color\Model

Extends: Model

File: Gray.php line 34

Gray Color Model class

Tags

Methods

__construct()

File: Gray.php line 53

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: Gray.php line 65

public getArray() : array<string, float>

Return values

array<string, float> —

with keys (‘G’, ‘A’)

getComponentsString()

File: Gray.php line 137

public getComponentsString() : string

Return values

string

getCssColor()

File: Gray.php line 111

public getCssColor() : string

The gray level is emitted as an integer in [0..255].

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: Gray.php line 125

public getJsPdfColor() : string

Return values

string

getNormalizedArray()

File: Gray.php line 98

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)

Return values

array<string, float> —

with keys (‘G’, ‘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: Gray.php line 83

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: 1 = DeviceGray

Return values

array<string|int, float> —

DeviceGray color component (‘G’)

getPdfColor()

File: Gray.php line 148

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: Gray.php line 224

public invertColor() : static

Return values

static

toCmykArray()

File: Gray.php line 206

public toCmykArray() : array<string, float>

Return values

array<string, float> —

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

toGrayArray()

File: Gray.php line 163

public toGrayArray() : array<string, float>

Return values

array<string, float> —

with keys (‘gray’, ‘alpha’)

toHslArray()

File: Gray.php line 191

public toHslArray() : array<string, float>

Return values

array<string, float> —

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

toLabArray()

File: Gray.php line 216

public toLabArray() : array<string, float>

Return values

array<string, float> —

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

toRgbArray()

File: Gray.php line 176

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