diff options
| author | pp <pp@455248ca-bdda-0310-9134-f4ebb693071a> | 2004-05-19 04:59:31 +0000 |
|---|---|---|
| committer | pp <pp@455248ca-bdda-0310-9134-f4ebb693071a> | 2004-05-19 04:59:31 +0000 |
| commit | d0a9b9a03fc7ae74ef8a64593ac6b592526ec4d5 (patch) | |
| tree | e03d2a7fac8c7619f1286545f717ef7ee3866cd6 /docs/class.ImlibColor.php | |
- initial import
git-svn-id: https://siedziba.pl:790/svn/repos/php-imlib/trunk@7 455248ca-bdda-0310-9134-f4ebb693071a
Diffstat (limited to 'docs/class.ImlibColor.php')
| -rw-r--r-- | docs/class.ImlibColor.php | 94 |
1 files changed, 94 insertions, 0 deletions
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 @@ +<?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; + } +}; + +?> |
