Re: trouble with entering bugs
| From: | Mattias Thorslund | Date: | Fri, 30 Mar 2007 21:12:09 +0000 |
| Subject: | Re: trouble with entering bugs | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-46117@lists.php.net to get a copy of this message | ||
Greg Beaver wrote:
> OK Mattias,
>
> Please try the form again with the same values. This time, you should
> get an error.
>
> Thanks,
> Greg
>
Oh well, I've had no luck with logging in so far.
Anyway, here's my bug report, for Image_Color 1.02. Can't keep it in my
head much longer.
The hsv2hex() function does not work with the edge cases. Apparently, it
was written to support ranges between 0 and 256 for the parameters $h
(hue) $s (saturation) and $v (value) [0]. But, it returns invalid
results in cases where the value of one or more parameters are either 0
or 256. Here's my test script:
$color =& new Image_Color();
echo "These examples produce invalid results\n";
echo "test 1: ".$color->hsv2hex(256.0, 256.0, 256.0)."\n";
echo "test 2: ".$color->hsv2hex(0.0, 256.0, 256.0)."\n";
echo "test 3: ".$color->hsv2hex(256.0, 0.0, 256.0)."\n";
echo "test 4: ".$color->hsv2hex(0.0, 0.0, 256.0)."\n";
echo "test 5: ".$color->hsv2hex(256.0, 0.0, 0.0)."\n";
echo "test 6: ".$color->hsv2hex(0.0, 256.0, 0.0)."\n";
echo "test 7: ".$color->hsv2hex(0.0, 0.0, 0.0)."\n";
echo "\n";
echo "These (tweaked) examples produce valid results\n";
echo "test 1.1: ".$color->hsv2hex(255.9, 256.0, 255.9)."\n";
echo "test 2.1: ".$color->hsv2hex(0.0, 256.0, 255.9)."\n";
echo "test 3.1: ".$color->hsv2hex(255.9, 0.01, 255.9)."\n";
echo "test 4.1: ".$color->hsv2hex(0.0, 0.01, 255.9)."\n";
echo "test 5.1: ".$color->hsv2hex(255.9, 0.01, 0.0)."\n";
echo "test 6.1: ".$color->hsv2hex(0.0, 256.0, 0.0)."\n";
echo "test 7.1: ".$color->hsv2hex(0.01, 0.01, 0.01)."\n";
For hue and value, the unsupported value appears to be 256. For
saturation, it appears to be 0.
[0] These are not the commonly used ranges however. They are 0-360 (hue)
and (0-100) saturation and value. See
http://en.wikipedia.org/wiki/HSV_color_space.
Anyway, that part is easy
to convert.
Please forward, thanks,
Mattias