PHP :: Bug #53154 :: Zero-height rectangle has whiskers
| Bug #53154 | Zero-height rectangle has whiskers | ||||
|---|---|---|---|---|---|
| Submitted: | 2010-10-25 21:31 UTC | Modified: | 2015-07-12 23:53 UTC | ||
| From: | lbayuk at users dot sourceforge dot net | Assigned: | cmb (profile) | ||
| Status: | Closed | Package: | GD related | ||
| PHP Version: | 5.6.10 | OS: | * | ||
| Private report: | No | CVE-ID: | None | ||
[2010-10-25 21:31 UTC] lbayuk at users dot sourceforge dot net
Description: ------------ Using imagerectangle() to draw a rectangle that happens to have zero height results in a horizontal line with small 'whiskers' at the ends. The whiskers extend up and down 1 pixel from the line. This looks weird. This only happens with unit line thickness. It does not happen with zero width rectangles, nor with imagefilledrectangle(). Note: Using PHP-bundled GD library. Test script: --------------- <?php $img = imagecreate(400, 200); $white = imagecolorallocate($img, 255, 255, 255); $black = imagecolorallocate($img, 0, 0, 0); $red = imagecolorallocate($img, 255, 0, 0); imagestring($img, 4, 5, 5, "RECTANGLES", $black); imagestring($img, 4, 150, 5, "Filled", $black); imagestring($img, 4, 300, 5, "Unfilled", $black); imagestring($img, 4, 5, 75, "Height=0", $black); imagestring($img, 4, 5, 145, "Width=0", $black); imagefilledrectangle($img, 150, 95, 200, 95, $black); imagerectangle($img, 300, 95, 350, 95, $black); imagefilledrectangle($img, 175, 125, 175, 175, $black); imagerectangle($img, 325, 125, 325, 175, $black); imageellipse($img, 325, 95, 90, 50, $red); // Circle the bad one imagepng($img); Expected result: ---------------- In all 4 cases, a single line should be drawn. Actual result: -------------- The upper right case (zero height, unfilled rectangle) has whiskers at the ends.
Patches
zero-rectangle (last revision 2015-06-29 11:34 UTC by cmb@php.net)Pull Requests
History
AllCommentsChangesGit/SVN commits
[2015-06-22 21:36 UTC] lbayuk at users dot sourceforge dot net
-: ljb9832 at pobox dot com +: lbayuk at users dot sourceforge dot net
[2015-06-22 21:36 UTC] lbayuk at users dot sourceforge dot net
[2015-06-28 20:15 UTC] cmb@php.net
-Status: Open +Status: Verified -Operating System: Linux +Operating System: * -PHP Version: 5.3.3 +PHP Version: 5.6.10 -Assigned To: +Assigned To: cmb
[2015-06-28 22:28 UTC] lbayuk at users dot sourceforge dot net
[2015-06-29 11:35 UTC] cmb@php.net
-Status: Verified +Status: Analyzed
[2015-06-29 11:35 UTC] cmb@php.net
[2015-06-29 20:15 UTC] lbayuk at users dot sourceforge dot net
[2015-07-12 23:51 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
[2015-07-12 23:53 UTC] cmb@php.net