PHP Класс Jyxo\Color

Автор: Roman Řáha
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( mixed $color = null ) Constructor.
__toString ( ) : string Returns textual (#RRGGBB) representation of the current color.
getBinary ( ) : integer Returns the current color in binary form 0 - black, 1 - white).
getBlue ( ) : integer Returns the blue component luminance.
getGreen ( ) : integer Returns the green component luminance.
getHex ( ) : string Returns the current color as a six-digit hexadecimal number.
getLuminance ( ) : integer Returns the color luminance according to the human perception.
getRed ( ) : integer Returns the red component luminance.
getRgb ( ) : array Returns the current color as an array of the red, green and blue components.
setBlue ( integer | string $blue ) : self Sets the blue component luminance.
setGreen ( integer | string $green ) : self Sets the green component luminance.
setLuminance ( integer | string $luminance ) : self Sets the color in grayscale according to the luminance value.
setRed ( integer | string $red ) : self Sets the red component luminance.
toGrayScale ( ) : self Returns the currect color converted to grayscale.
toInverse ( ) : self Returns an inverse color.

Приватные методы

Метод Описание
initFromHex ( string $hex ) : self Sets color components using a hexadecimal RRGGBB string.
initFromInt ( integer $int ) : self Sets color components from an integer.
initFromRgb ( array $rgb ) : self Sets color components from an array.
toInt ( integer | string $value ) : integer Returns the color luminance as a decimal integer.

Описание методов

__construct() публичный Метод

Accepts the following definition formats: * Hexadecimal string (with or without the hashmark at the beginning) * Array with red, green and blue component luminance values (in this order) * Number, * {@link \Jyxo\Color}, * null
public __construct ( mixed $color = null )
$color mixed Color definition

__toString() публичный Метод

Returns textual (#RRGGBB) representation of the current color.
public __toString ( ) : string
Результат string

getBinary() публичный Метод

Returns the current color in binary form 0 - black, 1 - white).
public getBinary ( ) : integer
Результат integer

getBlue() публичный Метод

Returns the blue component luminance.
public getBlue ( ) : integer
Результат integer

getGreen() публичный Метод

Returns the green component luminance.
public getGreen ( ) : integer
Результат integer

getHex() публичный Метод

Returns the current color as a six-digit hexadecimal number.
public getHex ( ) : string
Результат string

getLuminance() публичный Метод

Returns the color luminance according to the human perception.
public getLuminance ( ) : integer
Результат integer

getRed() публичный Метод

Returns the red component luminance.
public getRed ( ) : integer
Результат integer

getRgb() публичный Метод

Returns the current color as an array of the red, green and blue components.
public getRgb ( ) : array
Результат array

setBlue() публичный Метод

Sets the blue component luminance.
public setBlue ( integer | string $blue ) : self
$blue integer | string Component luminance
Результат self

setGreen() публичный Метод

Sets the green component luminance.
public setGreen ( integer | string $green ) : self
$green integer | string Component luminance
Результат self

setLuminance() публичный Метод

Sets the color in grayscale according to the luminance value.
public setLuminance ( integer | string $luminance ) : self
$luminance integer | string Luminance
Результат self

setRed() публичный Метод

Sets the red component luminance.
public setRed ( integer | string $red ) : self
$red integer | string Component luminance
Результат self

toGrayScale() публичный Метод

Returns the currect color converted to grayscale.
public toGrayScale ( ) : self
Результат self

toInverse() публичный Метод

Returns an inverse color.
public toInverse ( ) : self
Результат self