Jaguar - PHP Graphic Library
  • Namespace
  • Class
  • Tree

Namespaces

  • Jaguar
    • Action
      • Blur
      • Color
      • Pixelate
      • Preset
    • Color
    • Drawable
      • Border
      • Style
      • Text
    • Exception
    • Factory
    • Format
    • Gradient

Classes

  • AbstractColor
  • BrushedColor
  • RGBColor
  • StyledBrushedColor
  • StyledColor
  • TiledColor
  • TransparentColor

Interfaces

  • ColorInterface

Class RGBColor

Jaguar\Color\AbstractColor implements Jaguar\Color\ColorInterface
Extended by Jaguar\Color\RGBColor
Namespace: Jaguar\Color
Located at Jaguar/Color/RGBColor.php

Methods summary

public
# __construct( integer $r = 0, integer $g = 0, integer $b = 0, integer $a = 0 )

construct new color object

construct new color object

Parameters

$r
integer
$r red channel
$g
integer
$g green channel
$b
integer
$b blue channel
$a
integer
$a alpha channel
public boolean
# isValidChannelValue( integer $value, string $channel )

Check if the given value is valid for the given channel name

Check if the given value is valid for the given channel name

Parameters

$value
integer
$value
$channel
string
$channel on of the following : - RGBColor::CHANNEL_RED - RGBColor::CHANNEL_GREEN, - RGBColor::CHANNEL_BLUE, - RGBColor::CHANNEL_ALPHA,

Returns

boolean

Throws

InvalidArgumentException
if the channel name is not supported
public boolean
# isOpaque( )

Checks if the current color is opaque

Checks if the current color is opaque

Returns

boolean
true if opaque , false otherwise
public boolean
# isTransparent( )

Checks if the current color is transparent

Checks if the current color is transparent

Returns

boolean
true if transparent , false otherwise
public Jaguar\Color\RGBColor
# setAlpha( integer $alpha )

set alpha value

set alpha value

Parameters

$alpha
integer
$alpha in range (0,255)

Returns

Jaguar\Color\RGBColor

Throws

InvalidArgumentException
public integer
# getAlpha( )

Get alpha value

Get alpha value

Returns

integer
public Jaguar\Color\RGBColor
# setRed( integer $value )

Set red value

Set red value

Parameters

$value
integer
$value in range (0,255)

Returns

Jaguar\Color\RGBColor

Throws

InvalidArgumentException
public integer
# getRed( )

Get red value

Get red value

Returns

integer
public Jaguar\Color\RGBColor
# setGreen( integer $value )

Set green value

Set green value

Parameters

$value
integer
$value in range (0,255)

Returns

Jaguar\Color\RGBColor

Throws

InvalidArgumentException
public integer
# getGreen( )

Get green value

Get green value

Returns

integer
public Jaguar\Color\RGBColor
# setBlue( integer $value )

Set blue value

Set blue value

Parameters

$value
integer
$value in range (0,255)

Returns

Jaguar\Color\RGBColor

Throws

InvalidArgumentException
public integer
# getBlue( )

Get blue value

Get blue value

Returns

integer
public integer
# getValue( )

Get color value

Get color value

Returns

integer
public Jaguar\Color\RGBColor
# setFromRGBColor( Jaguar\Color\RGBColor $color )

Set color from another color object

Set color from another color object

Parameters

$color
Jaguar\Color\RGBColor
$color

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# setFromArray( array $color )

Set color from array

Set color from array

Parameters

$color
array
$color array with (red,green,blue,alpha) values

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# setFromValue( integer $rgb, boolean $hasalpha = true )

Set color from rgb integer

Set color from rgb integer

Parameters

$rgb
integer
$rgb
$hasalpha
boolean
$hasalpha true if the rgb contains the alpha and false if not

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# setFromHex( string $hex, integer $alpha = 0 )

Set color from hex string

Set color from hex string

Parameters

$hex
string
$hex color in hex format
$alpha
integer
$alpha alpha value

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# getRGBColor( )

Get new color object which is equal to the current one

Get new color object which is equal to the current one

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# dissolve( integer $alpha )

incrementing the alpha channel by the given amount

incrementing the alpha channel by the given amount

Parameters

$alpha
integer
$alpha

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# brighter( float $shade = 0.7 )

Create Brighter version of the current color using the specified number of shades

Create Brighter version of the current color using the specified number of shades

Parameters

$shade
float
shade default 0.7

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# darker( float $shade = 0.7 )

Create darker version of the current color using the specified number of shades

Create darker version of the current color using the specified number of shades

Parameters

$shade
float
shade default 0.7

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# blend( Jaguar\Color\RGBColor $color, float $amount )

Blend current color with the given new color and the amount

Blend current color with the given new color and the amount

Parameters

$color
Jaguar\Color\RGBColor
$color another color
$amount
float
$amount The amount of curennt color in the given color

Returns

Jaguar\Color\RGBColor
public Jaguar\Color\RGBColor
# grayscale( )

Gray current color

Gray current color

Returns

Jaguar\Color\RGBColor
public string
# __toString( )

Get string representation for the current color object

Get string representation for the current color object

Returns

string

Overrides

Jaguar\Color\AbstractColor::__toString
public static
# fromValue( mixed $rgb, mixed $hasalpha = true )

See

Jaguar\Color\RGBColor::setFromValue()

CodeCoverageIgnore

public static
# fromHex( mixed $hex, mixed $alpha = 0 )

See

Jaguar\Color\RGBColor::setFromHex()

CodeCoverageIgnore

public static
# fromArray( array $color )

See

Jaguar\Color\RGBColor::setFromArray()

CodeCoverageIgnore

Methods inherited from Jaguar\Color\AbstractColor

equals()

Magic methods summary

Constants summary

string CHANNEL_RED 'red'
#
string CHANNEL_GREEN 'green'
#
string CHANNEL_BLUE 'blue'
#
string CHANNEL_ALPHA 'alpha'
#
Jaguar - PHP Graphic Library API documentation generated by ApiGen 2.8.0