1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<?php
/**
* Provides variables and methods for handling color
*
* The variables and methods in this class provide a way to get and set the
* color to be used by any text or drawing functions.
*
* @version 0.3
* @author Matt McClanahan <cardinal@dodds.net>
* @package Imlib
* @access public
*/
class ImlibColor
{
/**
* The array defining the color (r,g,b,a)
*
* @var array $color
* @access private
*/
var $color;
/**
* ImlibColor constructor
*
* @access public
*/
function ImlibColor()
{
$this->color = 0;
}
/**
* Get the four color components as by-reference variables
*
* @param int &$r Red
* @param int &$g Blue
* @param int &$b Green
* @param int &$a Alpha
* @return mixed False if a color isn't set, the color array otherwise
* @access public
*/
function get_color(&$r,&$g,&$b,&$a)
{
if ($this->color)
list($r,$g,$b,$a) = $this->color;
else
return false;
return $this->color;
}
/**
* Get the color array currently defined, if it is defined
*
* @return mixed False if a color isn't set, the color array otherwise
* @access public
*/
function get_color_array()
{
if (!$this->color)
return false;
return $this->color;
}
/**
* Set the current color using the four components
*
* @param int Red
* @param int Blue
* @param int Green
* @param int Alpha
* @access public
*/
function set_color($r,$g,$b,$a)
{
$this->color = Array($r,$g,$b,$a);
}
/**
* Set the current color using an array of 4 elements (r,g,b,a)
*
* @param array Color array
* @access public
*/
function set_color_array($arr)
{
$this->color = $arr;
}
};
?>
|