From d0a9b9a03fc7ae74ef8a64593ac6b592526ec4d5 Mon Sep 17 00:00:00 2001 From: pp Date: Wed, 19 May 2004 04:59:31 +0000 Subject: - initial import git-svn-id: https://siedziba.pl:790/svn/repos/php-imlib/trunk@7 455248ca-bdda-0310-9134-f4ebb693071a --- docs/class.ImlibColor.php | 94 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 docs/class.ImlibColor.php (limited to 'docs/class.ImlibColor.php') diff --git a/docs/class.ImlibColor.php b/docs/class.ImlibColor.php new file mode 100644 index 0000000..b15e664 --- /dev/null +++ b/docs/class.ImlibColor.php @@ -0,0 +1,94 @@ + +* @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; + } +}; + +?> -- cgit v1.2.3