noalyss
Version-6.7.2
|
Public Member Functions | |
Securimage_Color ($red, $green=null, $blue=null) | |
Create a new Securimage_Color object. | |
Data Fields | |
$b | |
$g | |
$r |
Definition at line 1524 of file securimage.php.
Securimage_Color::Securimage_Color | ( | $ | red, |
$ | green = null , |
||
$ | blue = null |
||
) |
Create a new Securimage_Color object.
Specify the red, green, and blue components using their HTML hex code equivalent.
Example: The code for the HTML color #4A203C is:
$color = new Securimage_Color(0x4A, 0x20, 0x3C);
$red | Red component 0-255 |
$green | Green component 0-255 |
$blue | Blue component 0-255 |
Definition at line 1554 of file securimage.php.
References g().
{ if ($green == null && $blue == null && preg_match('/^#[a-f0-9]{3,6}$/i', $red)) { $col = substr($red, 1); if (strlen($col) == 3) { $red = str_repeat(substr($col, 0, 1), 2); $green = str_repeat(substr($col, 1, 1), 2); $blue = str_repeat(substr($col, 2, 1), 2); } else { $red = substr($col, 0, 2); $green = substr($col, 2, 2); $blue = substr($col, 4, 2); } $red = hexdec($red); $green = hexdec($green); $blue = hexdec($blue); } else { if ($red < 0) $red = 0; if ($red > 255) $red = 255; if ($green < 0) $green = 0; if ($green > 255) $green = 255; if ($blue < 0) $blue = 0; if ($blue > 255) $blue = 255; } $this->r = $red; $this->g = $green; $this->b = $blue; }
Securimage_Color::$b |
Definition at line 1542 of file securimage.php.
Securimage_Color::$g |
Definition at line 1536 of file securimage.php.
Securimage_Color::$r |
Definition at line 1530 of file securimage.php.