Documentation

Horde_Image
in package

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

Tags
author

Chuck Hagenbuch chuck@horde.org

author

Michael J. Rubinsky mrubinsk@horde.org

author

Jan Schneider jan@horde.org

category

Horde

copyright

2002-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL-2.1

Table of Contents

arcPoints()  : array<string|int, mixed>
Returns point coordinates at the limits of an arc.
brightness()  : int
Returns the brightness of a color.
circlePoint()  : array<string|int, mixed>
Returns an x,y pair on circle, assuming center is 0,0.
getColor()  : array<string|int, int>
Normalizes an HTML color.
getFontSize()  : mixed
Returns the point size for an HTML font size name.
getHexColor()  : string
Returns the hexadecimal representation of an HTML color name.
getRGB()  : array<string|int, mixed>
Returns the RGB values for an HTML color name.
grayscalePixel()  : array<string|int, int>
Turns an RGB value into grayscale.
grayscaleValue()  : int
Calculates the grayscale value of a color.
modifyColor()  : string
Calculates a lighter (or darker) version of a color.
moreIntenseColor()  : string
Calculates a more intense version of a color.

Methods

arcPoints()

Returns point coordinates at the limits of an arc.

public static arcPoints(int $r, int $start, int $end) : array<string|int, mixed>
Parameters
$r : int

The radius of the arc.

$start : int

The starting angle.

$end : int

The ending angle.

Return values
array<string|int, mixed>

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

brightness()

Returns the brightness of a color.

public static brightness(string $color) : int
Parameters
$color : string

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

Return values
int

The brightness on a scale of 0 to 255.

circlePoint()

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

public static circlePoint(float $degrees, int $diameter) : array<string|int, mixed>
Parameters
$degrees : float

The degrees of arc to get the point for.

$diameter : int

The diameter of the circle.

Return values
array<string|int, mixed>

(x coordinate, y coordinate) of the point.

getColor()

Normalizes an HTML color.

public static getColor(string $color) : array<string|int, int>
Parameters
$color : string

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

Return values
array<string|int, int>

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

getFontSize()

Returns the point size for an HTML font size name.

public static getFontSize(mixed $fontsize) : mixed
Parameters
$fontsize : mixed
Return values
mixed

getHexColor()

Returns the hexadecimal representation of an HTML color name.

public static getHexColor(string $colorname) : string
Parameters
$colorname : string

A color name.

Return values
string

The hex representation of the color.

getRGB()

Returns the RGB values for an HTML color name.

public static getRGB(string $colorname) : array<string|int, mixed>
Parameters
$colorname : string

A color name.

Return values
array<string|int, mixed>

An array of RGB values.

grayscalePixel()

Turns an RGB value into grayscale.

public static grayscalePixel(array<string|int, int> $originalPixel) : array<string|int, int>
Parameters
$originalPixel : array<string|int, int>

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

Return values
array<string|int, int>

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

grayscaleValue()

Calculates the grayscale value of a color.

public static grayscaleValue(int $r, int $g, int $b) : int
Parameters
$r : int

A red value.

$g : int

A green value.

$b : int

A blue value.

Return values
int

The grayscale value of the color.

modifyColor()

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

public static modifyColor(string $color[, int $factor = 0x11 ]) : string
Parameters
$color : string

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

$factor : int = 0x11

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

Return values
string

A modified HTML color.

moreIntenseColor()

Calculates a more intense version of a color.

public static moreIntenseColor(string $color[, int $factor = 0x11 ]) : string
Parameters
$color : string

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

$factor : int = 0x11

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

Return values
string

A more intense HTML color.

Search results