Bug #53154 [NEW]: Zero-height rectangle has whiskers
| From: | ljb9832 at pobox dot com | Date: | Mon, 25 Oct 2010 19:31:02 +0000 |
| Subject: | Bug #53154 [NEW]: Zero-height rectangle has whiskers | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-155506@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: 5.3.3
Package: GD related
Bug Type: Bug
Bug description:Zero-height rectangle has whiskers
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 bug report at http://bugs.php.net/bug.php?id=53154&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53154&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53154&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53154&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53154&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53154&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53154&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53154&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53154&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53154&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53154&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53154&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53154&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53154&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53154&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53154&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53154&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53154&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53154&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53154&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53154&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53154&r=mysqlcfg