noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
Securimage_Color Class Reference
+ Collaboration diagram for Securimage_Color:

Public Member Functions

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

Data Fields

 $b
 
 $g
 
 $r
 

Detailed Description

Definition at line 1546 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 1576 of file securimage.php.

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

Field Documentation

◆ $b

Securimage_Color::$b

Definition at line 1564 of file securimage.php.

◆ $g

Securimage_Color::$g

Definition at line 1558 of file securimage.php.

◆ $r

Securimage_Color::$r

Definition at line 1552 of file securimage.php.


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