class ImagickPixel (View source)

Methods

float[]
getHSL()

(PECL imagick 2.0.0)
Returns the normalized HSL color of the ImagickPixel object

bool
setHSL(float $hue, float $saturation, float $luminosity)

(PECL imagick 2.0.0)
Sets the normalized HSL color

getColorValueQuantum()

No description

setColorValueQuantum($color_value)

No description

getIndex()

Gets the colormap index of the pixel wand.

setIndex(int $index)

No description

__construct(string $color = null)

(PECL imagick 2.0.0)
The ImagickPixel constructor

bool
setColor(string $color)

(PECL imagick 2.0.0)
Sets the color

bool
setColorValue(int $color, float $value)

(PECL imagick 2.0.0)
Sets the normalized value of one of the channels

float
getColorValue(int $color)

(PECL imagick 2.0.0)
Gets the normalized value of the provided color channel

bool
clear()

(PECL imagick 2.0.0)
Clears resources associated with this object

bool
destroy()

(PECL imagick 2.0.0)
Deallocates resources associated with this object

bool
isSimilar(ImagickPixel $color, float $fuzz)

(PECL imagick 2.0.0)
Check the distance between this color and another

bool
isPixelSimilar(ImagickPixel $color, float $fuzz)

(No version information available, might only be in SVN)
Check the distance between this color and another

array
getColor(int $normalized = 0)

(PECL imagick 2.0.0)
Returns the color

string
getColorAsString()

(PECL imagick 2.1.0)
Returns the color as a string

int
getColorCount()

(PECL imagick 2.0.0)
Returns the color count associated with this color

setColorCount(int $colorCount)

No description

bool
isPixelSimilarQuantum(string $color, string $fuzz)

Returns true if the distance between two colors is less than the specified distance. The fuzz value should be in the range 0-QuantumRange.
The maximum value represents the longest possible distance in the colorspace. e.g. from RGB(0, 0, 0) to RGB(255, 255, 255) for the RGB colorspace

mixed
getColorQuantum()

Returns the color of the pixel in an array as Quantum values. If ImageMagick was compiled as HDRI these will be floats, otherwise they will be integers.

bool
setColorFromPixel(ImagickPixel $srcPixel)

Sets the color count associated with this color from another ImagickPixel object.

void
clone()

No description

Details

float[] getHSL()

(PECL imagick 2.0.0)
Returns the normalized HSL color of the ImagickPixel object

Return Value

float[]

the HSL value in an array with the keys "hue", "saturation", and "luminosity". Throws ImagickPixelException on failure.

Exceptions

ImagickPixelException

bool setHSL(float $hue, float $saturation, float $luminosity)

(PECL imagick 2.0.0)
Sets the normalized HSL color

Parameters

float $hue

The normalized value for hue, described as a fractional arc (between 0 and 1) of the hue circle, where the zero value is red.

float $saturation

The normalized value for saturation, with 1 as full saturation.

float $luminosity

The normalized value for luminosity, on a scale from black at 0 to white at 1, with the full HS value at 0.5 luminosity.

Return Value

bool

TRUE on success.

Exceptions

ImagickPixelException

getColorValueQuantum()

No description

setColorValueQuantum($color_value)

No description

Parameters

$color_value

Exceptions

ImagickPixelException

getIndex()

Gets the colormap index of the pixel wand.

setIndex(int $index)

No description

Parameters

int $index

Exceptions

ImagickPixelException

__construct(string $color = null)

(PECL imagick 2.0.0)
The ImagickPixel constructor

Parameters

string $color

[optional]

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

Exceptions

ImagickPixelException

bool setColor(string $color)

(PECL imagick 2.0.0)
Sets the color

Parameters

string $color

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

Return Value

bool

TRUE if the specified color was set, FALSE otherwise.

Exceptions

ImagickPixelException

bool setColorValue(int $color, float $value)

(PECL imagick 2.0.0)
Sets the normalized value of one of the channels

Parameters

int $color

One of the Imagick color constants e.g. \Imagick::COLOR_GREEN or \Imagick::COLOR_ALPHA.

float $value

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

Return Value

bool

TRUE on success.

Exceptions

ImagickPixelException

float getColorValue(int $color)

(PECL imagick 2.0.0)
Gets the normalized value of the provided color channel

Parameters

int $color

The color to get the value of, specified as one of the Imagick color constants. This can be one of the RGB colors, CMYK colors, alpha and opacity e.g (Imagick::COLOR_BLUE, Imagick::COLOR_MAGENTA).

Return Value

float

The value of the channel, as a normalized floating-point number, throwing ImagickPixelException on error.

Exceptions

ImagickPixelException

bool clear()

(PECL imagick 2.0.0)
Clears resources associated with this object

Return Value

bool

TRUE on success.

Exceptions

ImagickPixelException

bool destroy()

(PECL imagick 2.0.0)
Deallocates resources associated with this object

Return Value

bool

TRUE on success.

Exceptions

ImagickPixelException

bool isSimilar(ImagickPixel $color, float $fuzz)

(PECL imagick 2.0.0)
Check the distance between this color and another

Parameters

ImagickPixel $color

The ImagickPixel object to compare this object against.

float $fuzz

The maximum distance within which to consider these colors as similar. The theoretical maximum for this value is the square root of three (1.732).

Return Value

bool

TRUE on success.

Exceptions

ImagickPixelException

bool isPixelSimilar(ImagickPixel $color, float $fuzz)

(No version information available, might only be in SVN)
Check the distance between this color and another

Parameters

ImagickPixel $color

The ImagickPixel object to compare this object against.

float $fuzz

The maximum distance within which to consider these colors as similar. The theoretical maximum for this value is the square root of three (1.732).

Return Value

bool

TRUE on success.

Exceptions

ImagickPixelException

array getColor(int $normalized = 0)

(PECL imagick 2.0.0)
Returns the color

Parameters

int $normalized

[optional]

Normalize the color values

Return Value

array

An array of channel values, each normalized if TRUE is given as param. Throws ImagickPixelException on error.

Exceptions

ImagickPixelException

string getColorAsString()

(PECL imagick 2.1.0)
Returns the color as a string

Return Value

string

the color of the ImagickPixel object as a string.

Exceptions

ImagickPixelException

int getColorCount()

(PECL imagick 2.0.0)
Returns the color count associated with this color

Return Value

int

the color count as an integer on success, throws ImagickPixelException on failure.

Exceptions

ImagickPixelException

setColorCount(int $colorCount)

No description

Parameters

int $colorCount

Exceptions

ImagickPixelException

bool isPixelSimilarQuantum(string $color, string $fuzz)

Since: 3.3.0

Returns true if the distance between two colors is less than the specified distance. The fuzz value should be in the range 0-QuantumRange.
The maximum value represents the longest possible distance in the colorspace. e.g. from RGB(0, 0, 0) to RGB(255, 255, 255) for the RGB colorspace

Parameters

string $color
string $fuzz

Return Value

bool

Exceptions

ImagickPixelException

mixed getColorQuantum()

Since: 3.3.0

Returns the color of the pixel in an array as Quantum values. If ImageMagick was compiled as HDRI these will be floats, otherwise they will be integers.

Return Value

mixed

The quantum value of the color element. Float if ImageMagick was compiled with HDRI, otherwise an int.

Exceptions

ImagickPixelException

bool setColorFromPixel(ImagickPixel $srcPixel)

Since: 3.4.1

Sets the color count associated with this color from another ImagickPixel object.

Parameters

ImagickPixel $srcPixel

Return Value

bool

Exceptions

ImagickPixelException

void clone()

No description

Return Value

void