PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Images » Image_Color » Bug #3093

improve readability with a new 'range' method

Details

Request #3093improve readability with a new 'range' method
Submitted2005-01-04 15:59 UTC
Frommquinton at gmail dot com
StatusOpen
PackageImage_Color
PHP VersionIrrelevant
OSirrelevant
Roadmaps(Not assigned)

Comments

[2005-01-04 15:59 UTC] mquinton at gmail dot com

Description:
------------
may be create a method to insure a 'range' value for RGB values like this ; also, lighter() and darker methods are more usable with this specifications.

this _range() method could be used in many method from Image_Color class.

function lighter($color, $degree = 10){
for ( $x = 0; $x < 3; $x++ )
$color[$x] = $this->_range($color[$x]+$degree, 0, 255);

return $color;
}

function darker($color, $degree = -10){
return $this->lighter($color, -$degree);
}

function _range($val, $min, $max){
if($val < $min)
return $min;
if($val > $max)
return $max;
return $val;
}

[2005-01-04 16:02 UTC] mquinton at gmail dot com

subject seems to be wrong.

[2005-01-04 16:04 UTC] mquinton at gmail dot com

my mozilla registred 2 fields (subject and package), so I need to correct.

[2005-09-11 05:01 UTC] drewish at php dot net

first off, sorry this go ignored for so long. i've just taken over the package. i like the idea of having separate lighter darker methods. i'm going to commit a couple of bug fixes and get a release out and then look at adding some features like this.