\Horde_Image

This class provides some utility functions, such as generating highlights of a color.

Summary

Methods
Properties
Constants
modifyColor()
moreIntenseColor()
brightness()
grayscaleValue()
grayscalePixel()
getColor()
getRGB()
getHexColor()
circlePoint()
arcPoints()
getFontSize()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

modifyColor()

modifyColor(string  $color, integer  $factor = 17) : string

Calculates a lighter (or darker) version of a color.

Parameters

string $color

An HTML color, e.g.: #ffffcc.

integer $factor

The brightness difference between -0xff and +0xff. Plus values raise the brightness, negative values reduce it.

Returns

string —

A modified HTML color.

moreIntenseColor()

moreIntenseColor(string  $color, integer  $factor = 17) : string

Calculates a more intense version of a color.

Parameters

string $color

An HTML color, e.g.: #ffffcc.

integer $factor

The intensity difference between -0xff and +0xff. Plus values raise the intensity, negative values reduce it.

Returns

string —

A more intense HTML color.

brightness()

brightness(string  $color) : integer

Returns the brightness of a color.

Parameters

string $color

An HTML color, e.g.: #ffffcc.

Returns

integer —

The brightness on a scale of 0 to 255.

grayscaleValue()

grayscaleValue(integer  $r, integer  $g, integer  $b) : integer

Calculates the grayscale value of a color.

Parameters

integer $r

A red value.

integer $g

A green value.

integer $b

A blue value.

Returns

integer —

The grayscale value of the color.

grayscalePixel()

grayscalePixel(array<mixed,integer>  $originalPixel) : array<mixed,integer>

Turns an RGB value into grayscale.

Parameters

array<mixed,integer> $originalPixel

A hash with 'red', 'green', and 'blue' values.

Returns

array<mixed,integer> —

A hash with 'red', 'green', and 'blue' values for the corresponding gray color.

getColor()

getColor(string  $color) : array<mixed,integer>

Normalizes an HTML color.

Parameters

string $color

An HTML color, e.g.: #ffffcc or #ffc.

Returns

array<mixed,integer> —

Array with three elements: red, green, and blue.

getRGB()

getRGB(string  $colorname) : array

Returns the RGB values for an HTML color name.

Parameters

string $colorname

A color name.

Returns

array —

An array of RGB values.

getHexColor()

getHexColor(string  $colorname) : string

Returns the hexadecimal representation of an HTML color name.

Parameters

string $colorname

A color name.

Returns

string —

The hex representation of the color.

circlePoint()

circlePoint(float  $degrees, integer  $diameter) : array

Returns an x,y pair on circle, assuming center is 0,0.

Parameters

float $degrees

The degrees of arc to get the point for.

integer $diameter

The diameter of the circle.

Returns

array —

(x coordinate, y coordinate) of the point.

arcPoints()

arcPoints(integer  $r, integer  $start, integer  $end) : array

Returns point coordinates at the limits of an arc.

Parameters

integer $r

The radius of the arc.

integer $start

The starting angle.

integer $end

The ending angle.

Returns

array —

The start point (x1,y1), end point (x2,y2), and anchor point (x3,y3).

getFontSize()

getFontSize(  $fontsize) 

Returns the point size for an HTML font size name.

Parameters

$fontsize