Bug #53154 [Opn]: Zero-height rectangle has whiskers
| From: | lbayuk at users dot sourceforge dot net | Date: | Mon, 22 Jun 2015 21:36:45 +0000 |
| Subject: | Bug #53154 [Opn]: Zero-height rectangle has whiskers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193769@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53154&edit=1
ID: 53154
User updated by: lbayuk at users dot sourceforge dot net
Reported by: lbayuk at users dot sourceforge dot net
Summary: Zero-height rectangle has whiskers
Status: Open
Type: Bug
Package: GD related
Operating System: Linux
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
Verified still there in PHP-5.6.10
Previous Comments:
------------------------------------------------------------------------
[2010-10-25 21:31:01] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=53154&edit=1