class GmagickPixel (View source)

Methods

__construct(string $color = null)

The GmagickPixel constructor.

mixed
getcolor(bool $as_array = null, bool $normalize_array = null)

Returns the color described by the GmagickPixel object.

int
getcolorcount()

Returns the color count associated with this color.

float
getcolorvalue(int $color)

Gets the normalized value of the provided color channel.

setcolor(string $color)

Sets the color.

setcolorvalue(int $color, float $value)

Sets the normalized value of one of the channels.

Details

__construct(string $color = null)

The GmagickPixel constructor.

If a color is specified, the object is constructed and then initialised with that color before being returned.

Parameters

string $color

[optional] The optional color string to use as the initial value of this object.

mixed getcolor(bool $as_array = null, bool $normalize_array = null)

Returns the color described by the GmagickPixel object.

If the color has an opacity channel set, this is provided as a fourth value in the list.

Parameters

bool $as_array

[optional] True to indicate return of array instead of string.

bool $normalize_array

[optional] Normalize the color values.

Return Value

mixed

A string or array of channel values, each normalized if TRUE is given as param.

Exceptions

GmagickPixelException

int getcolorcount()

Returns the color count associated with this color.

Return Value

int

The color count as an integer.

Exceptions

GmagickPixelException

float getcolorvalue(int $color)

Gets the normalized value of the provided color channel.

Parameters

int $color

The channel to check, specified as one of the Gmagick channel constants.

Return Value

float

The value of the color channel specified, as a floating-point number between 0 and 1.

Exceptions

GmagickPixelException

GmagickPixel setcolor(string $color)

Sets the color.

Sets the color described by the GmagickPixel object, with a string (e.g. "blue", "#0000ff", "rgb(0,0,255)", "cmyk(100,100,100,10)", etc.).

Parameters

string $color

The color definition to use in order to initialise the GmagickPixel object.

Return Value

GmagickPixel

The GmagickPixel object on success.

GmagickPixel setcolorvalue(int $color, float $value)

Sets the normalized value of one of the channels.

Sets the value of the specified channel of this object to the provided value, which should be between 0 and 1. This function can be used to provide an opacity channel to a GmagickPixel object.

Parameters

int $color

One of the Gmagick channel color constants.

float $value

The value to set this channel to, ranging from 0 to 1.

Return Value

GmagickPixel

The GmagickPixel object on success.