Documentation

Color extends AbstractColor
in package

Table of Contents

Properties

$a  : float
RGB Alpha value of current color instance
$b  : int
RGB Blue value of current color instance
$g  : int
RGB Green value of current color instance
$r  : int
RGB Red value of current color instance

Methods

__construct()  : mixed
Creates new instance
differs()  : bool
Determines if current color is different from given color
format()  : mixed
Formats current color instance into given format
getArray()  : array<string|int, mixed>
Calculates RGB(A) in array format of current color instance
getHex()  : string
Calculates hexadecimal value of current color instance
getInt()  : int
Calculates integer value of current color instance
getRgba()  : string
Calculates RGBA in string format of current color instance
initFromArray()  : AbstractColor
Initiates color object from given array
initFromInteger()  : AbstractColor
Initiates color object from integer
initFromObject()  : AbstractColor
Initiates color object from given ImagickPixel object
initFromRgb()  : AbstractColor
Initiates color object from given R, G and B values
initFromRgba()  : AbstractColor
Initiates color object from given R, G, B and A values
initFromString()  : AbstractColor
Initiates color object from given string
parse()  : AbstractColor
Parses given value as color
rgbaFromString()  : array<string|int, mixed>
Reads RGBA values from string into array
alpha2gd()  : int
Convert rgba alpha (0-1) value to gd value (0-127)

Properties

$a

RGB Alpha value of current color instance

public float $a

$b

RGB Blue value of current color instance

public int $b

$g

RGB Green value of current color instance

public int $g

$r

RGB Red value of current color instance

public int $r

Methods

__construct()

Creates new instance

public __construct([mixed $value = null ]) : mixed
Parameters
$value : mixed = null

differs()

Determines if current color is different from given color

public differs(AbstractColor $color[, int $tolerance = 0 ]) : bool
Parameters
$color : AbstractColor
$tolerance : int = 0
Return values
bool

format()

Formats current color instance into given format

public format(string $type) : mixed
Parameters
$type : string

getArray()

Calculates RGB(A) in array format of current color instance

public getArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

getHex()

Calculates hexadecimal value of current color instance

public getHex([string $prefix = '' ]) : string
Parameters
$prefix : string = ''
Return values
string

getInt()

Calculates integer value of current color instance

public getInt() : int
Return values
int

getRgba()

Calculates RGBA in string format of current color instance

public getRgba() : string
Return values
string

initFromArray()

Initiates color object from given array

public initFromArray(mixed $array) : AbstractColor
Parameters
$array : mixed
Return values
AbstractColor

initFromObject()

Initiates color object from given ImagickPixel object

public initFromObject(ImagickPixel $value) : AbstractColor
Parameters
$value : ImagickPixel
Return values
AbstractColor

initFromRgb()

Initiates color object from given R, G and B values

public initFromRgb(int $r, int $g, int $b) : AbstractColor
Parameters
$r : int
$g : int
$b : int
Return values
AbstractColor

initFromRgba()

Initiates color object from given R, G, B and A values

public initFromRgba(int $r, int $g, int $b[, float $a = 1 ]) : AbstractColor
Parameters
$r : int
$g : int
$b : int
$a : float = 1
Return values
AbstractColor

initFromString()

Initiates color object from given string

public initFromString(string $value) : AbstractColor
Parameters
$value : string
Return values
AbstractColor

rgbaFromString()

Reads RGBA values from string into array

protected rgbaFromString(string $value) : array<string|int, mixed>
Parameters
$value : string
Return values
array<string|int, mixed>

alpha2gd()

Convert rgba alpha (0-1) value to gd value (0-127)

private alpha2gd(float $input) : int
Parameters
$input : float
Return values
int

        
On this page

Search results