cvs: pear /Image_Color Color.php package.xml

From: Date: Sat, 17 Apr 2004 11:37:20 +0000
Subject: cvs: pear /Image_Color Color.php package.xml
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-18343@lists.php.net to get a copy of this message
sebastian Sat Apr 17 07:37:20 2004 EDT Modified files: /pear/Image_Color Color.php package.xml Log: Patch by Laurent Laville <pear@laurent-laville.org>. http://cvs.php.net/diff.php/pear/Image_Color/Color.php?r1=1.11&r2=1.12&ty=u Index: pear/Image_Color/Color.php diff -u pear/Image_Color/Color.php:1.11 pear/Image_Color/Color.php:1.12 --- pear/Image_Color/Color.php:1.11 Sun Oct 12 10:33:56 2003 +++ pear/Image_Color/Color.php Sat Apr 17 07:37:19 2004 @@ -15,9 +15,10 @@ // | Authors: Jason Lotito <jason@lehighweb.com> | // | Ulf Wendel <ulf.wendel@phpdoc.de> | // | Sebastian Bergmann <sb@sebastian-bergmann.de> | +// | Laurent Laville <pear@laurent-laville.org> | // +----------------------------------------------------------------------+ // -// $Id: Color.php,v 1.11 2003/10/12 14:33:56 sebastian Exp $ +// $Id: Color.php,v 1.12 2004/04/17 11:37:19 sebastian Exp $ /** * Color @@ -469,12 +470,30 @@ * @access public */ function allocateColor(&$img, $color) { - $color = $this->color2RGB($color); + $color = Image_Color::color2RGB($color); return ImageColorAllocate($img, $color[0], $color[1], $color[2]); } /** + * @access public + * @static + * @author Laurent Laville <pear@laurent-laville.org> + */ + function color2RGB($color) + { + $c = array(); + + if ($color{0} == '#') { + $c = Image_Color::hex2rgb($color); + } else { + $c = Image_Color::namedColor2RGB($color); + } + + return $c; + } + + /** * Returns the RGB interger values of a named color, [0,0,0] if unknown. * * The static variable $colornames is used to resolve http://cvs.php.net/diff.php/pear/Image_Color/package.xml?r1=1.8&r2=1.9&ty=u Index: pear/Image_Color/package.xml diff -u pear/Image_Color/package.xml:1.8 pear/Image_Color/package.xml:1.9 --- pear/Image_Color/package.xml:1.8 Sun Feb 8 07:41:13 2004 +++ pear/Image_Color/package.xml Sat Apr 17 07:37:19 2004 @@ -20,12 +20,17 @@ </maintainers> <license>PHP License</license> <release> - <version>0.4</version> - <date>2003-01-02</date> + <version>1.0.0</version> + <date>2004-04-17</date> <state>stable</state> <notes> <![CDATA[ -* Made namedColor2RGB() method static. ++ Added color2RGB() method. + + (Contribution by Laurent Laville <pear@laurent-laville.org>) + +* allocateColor() now works with both color names and + hex color codes. ]]> </notes> <filelist> @@ -39,6 +44,15 @@ </release> <changelog> <release> + <version>0.4</version> + <date>2003-01-02</date> + <notes> +<![CDATA[ +* Made namedColor2RGB() method static. +]]> + </notes> + </release> + <release> <version>0.3</version> <date>2002-04-08</date> <notes>

« previous php.pear.cvs (#18343) next »