Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.6

Request #3093 improve readability with a new 'range' method
Submitted: 2005-01-04 15:59 UTC
From: mquinton at gmail dot com Assigned:
Status: Open Package: Image_Color
PHP Version: Irrelevant OS: irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 1 + 35 = ?

 
 [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; }

Comments

 [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.