Definition at line 2125 of file securimage.php.
◆ __construct()
Securimage_Color::__construct |
( |
|
$color = '#ffffff' | ) |
|
Create a new Securimage_Color object.
Constructor expects 1 or 3 arguments.
When passing a single argument, specify the color using HTML hex format,
when passing 3 arguments, specify each RGB component (from 0-255) individually.
$color = new Securimage_Color('#0080FF') or
$color = new Securimage_Color(0, 128, 255)
- Parameters
-
- Exceptions
-
Definition at line 2142 of file securimage.php.
2144 $args = func_get_args();
2146 if (
sizeof($args) == 0) {
2150 }
else if (
sizeof($args) == 1) {
2152 if (substr($color, 0, 1) ==
'#') {
2153 $color = substr($color, 1);
2156 if (strlen($color) != 3 && strlen($color) != 6) {
2158 'Invalid HTML color code passed to Securimage_Color' 2163 }
else if (
sizeof($args) == 3) {
2167 'Securimage_Color constructor expects 0, 1 or 3 arguments; ' .
sizeof($args) .
' given' constructHTML($color)
Construct from an html hex color code.
constructRGB($red, $green, $blue)
Construct from an rgb triplet.
◆ constructHTML()
Securimage_Color::constructHTML |
( |
|
$color | ) |
|
|
protected |
Construct from an html hex color code.
- Parameters
-
Definition at line 2196 of file securimage.php.
References $blue, $green, and $red.
2198 if (strlen($color) == 3) {
2199 $red = str_repeat(substr($color, 0, 1), 2);
2200 $green = str_repeat(substr($color, 1, 1), 2);
2201 $blue = str_repeat(substr($color, 2, 1), 2);
2203 $red = substr($color, 0, 2);
2204 $green = substr($color, 2, 2);
2205 $blue = substr($color, 4, 2);
2208 $this->r = hexdec(
$red);
2209 $this->g = hexdec(
$green);
2210 $this->b = hexdec(
$blue);
◆ constructRGB()
Securimage_Color::constructRGB |
( |
|
$red, |
|
|
|
$green, |
|
|
|
$blue |
|
) |
| |
|
protected |
Construct from an rgb triplet.
- Parameters
-
int | $red | The red component, 0-255 |
int | $green | The green component, 0-255 |
int | $blue | The blue component, 0-255 |
Definition at line 2178 of file securimage.php.
References $blue, $green, and $red.
◆ $b
◆ $g
◆ $r
The documentation for this class was generated from the following file: