noalyss Version-9
Public Member Functions | Data Fields
Securimage_Color Class Reference
+ Collaboration diagram for Securimage_Color:

Public Member Functions

 __construct ($red, $green=null, $blue=null)
 Create a new Securimage_Color object. More...
 

Data Fields

 $b
 
 $g
 
 $r
 

Detailed Description

Definition at line 1543 of file securimage.php.

Constructor & Destructor Documentation

◆ __construct()

Securimage_Color::__construct (   $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);

Parameters
$redRed component 0-255
$greenGreen component 0-255
$blueBlue component 0-255

Definition at line 1573 of file securimage.php.

1574 {
1575 if ($green == null && $blue == null && preg_match('/^#[a-f0-9]{3,6}$/i', $red)) {
1576 $col = substr($red, 1);
1577 if (strlen($col) == 3) {
1578 $red = str_repeat(substr($col, 0, 1), 2);
1579 $green = str_repeat(substr($col, 1, 1), 2);
1580 $blue = str_repeat(substr($col, 2, 1), 2);
1581 } else {
1582 $red = substr($col, 0, 2);
1583 $green = substr($col, 2, 2);
1584 $blue = substr($col, 4, 2);
1585 }
1586
1587 $red = hexdec($red);
1588 $green = hexdec($green);
1589 $blue = hexdec($blue);
1590 } else {
1591 if ($red < 0) $red = 0;
1592 if ($red > 255) $red = 255;
1593 if ($green < 0) $green = 0;
1594 if ($green > 255) $green = 255;
1595 if ($blue < 0) $blue = 0;
1596 if ($blue > 255) $blue = 255;
1597 }
1598
1599 $this->r = $red;
1600 $this->g = $green;
1601 $this->b = $blue;
1602 }

Field Documentation

◆ $b

Securimage_Color::$b

Definition at line 1561 of file securimage.php.

◆ $g

Securimage_Color::$g

Definition at line 1555 of file securimage.php.

◆ $r

Securimage_Color::$r

Definition at line 1549 of file securimage.php.


The documentation for this class was generated from the following file: