Imagine API
Class

Imagine\Image\Color

class Color

The color class

Methods

__construct(array|string|integer $color, integer $alpha)

Constructs image color, e.g.: - new Color('fff') - will produce non-transparent white color - new Color('ffffff', 50) - will product 50% transparent white - new Color(array(255, 255, 255)) - another way of getting white - new Color(0x00FF00) - hexadecimal notation for green

integer getRed()

Returns RED value of the color

integer getGreen()

Returns GREEN value of the color

integer getBlue()

Returns BLUE value of the color

integer getAlpha()

Returns percentage of transparency of the color

Color dissolve(integer $alpha)

Returns a copy of current color, incrementing the alpha channel by the given amount

Color lighten(integer $shade)

Returns a copy of the current color, lightened by the specified number of shades

Color darken(integer $shade)

Returns a copy of the current color, darkened by the specified number of shades

string __toString()

Returns hex representation of the color

Boolean isOpaque()

Checks if the current color is opaque

Details

at line 51
public __construct(array|string|integer $color, integer $alpha)

Constructs image color, e.g.: - new Color('fff') - will produce non-transparent white color - new Color('ffffff', 50) - will product 50% transparent white - new Color(array(255, 255, 255)) - another way of getting white - new Color(0x00FF00) - hexadecimal notation for green

Parameters

array|string|integer $color
integer $alpha

at line 62
public integer getRed()

Returns RED value of the color

Return Value

integer

at line 72
public integer getGreen()

Returns GREEN value of the color

Return Value

integer

at line 82
public integer getBlue()

Returns BLUE value of the color

Return Value

integer

at line 92
public integer getAlpha()

Returns percentage of transparency of the color

Return Value

integer

at line 105
public Color dissolve(integer $alpha)

Returns a copy of current color, incrementing the alpha channel by the given amount

Parameters

integer $alpha

Return Value

Color

at line 118
public Color lighten(integer $shade)

Returns a copy of the current color, lightened by the specified number of shades

Parameters

integer $shade

Return Value

Color

at line 138
public Color darken(integer $shade)

Returns a copy of the current color, darkened by the specified number of shades

Parameters

integer $shade

Return Value

Color

at line 230
public string __toString()

Returns hex representation of the color

Return Value

string

at line 240
public Boolean isOpaque()

Checks if the current color is opaque

Return Value

Boolean