#41717 [NEW]: Problem with imagethickness() and imagepolygon()

From: Date: Sat, 16 Jun 2007 23:50:42 +0000
Subject: #41717 [NEW]: Problem with imagethickness() and imagepolygon()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113860@lists.php.net to get a copy of this message
From: c dot bezemer at student dot tudelft dot nl Operating system: windows and linux PHP version: 5.2.3 PHP Bug Type: GD related Bug description: Problem with imagethickness() and imagepolygon() Description: ------------ When drawing a polygon with the default thickness everything is fine; but when setting the thickness of the line > 1, I get strange results. It looks as if certain lines of the polygons are not being drawn with the correct thickness. Reproduce code: --------------- function getPolygon($width, $border_width, $sides) { $xcen = $width; $ycen = $width; $incr = 360/$sides; $angle = 180; $k = 0; $max_height = 0; for($j = 0; $j < $sides; $j++) { $points[$k] = $xcen + $width * sin(deg2rad($angle)) + $border_width; $k++; $points[$k] = $ycen + $width * cos(deg2rad($angle)) + $border_width; $max_height = max($max_height, $points[$k]); $k++; $angle += $incr; } $img = imagecreatetruecolor(2*$width+10, $max_height+$border_width+10); $bg = imagecolorallocate($img,255,255,255); ImageFill($img, 0, 0, $bg); imagecolorallocate($img, 255, 255, 255); $black = imagecolorallocate($img,0,0,0); imagesetthickness($img,$border_width); imagepolygon($img,$points,$sides,$black); header("Content-type: image/gif"); imagegif ($img); imagedestroy($img); } getPolygon(100, 5, 9); Expected result: ---------------- For 9 sides, it should be like http://www.gabber.nl/cp/geometry_1px.gif with a thicker line. Actual result: -------------- The output is http://www.gabber.nl/cp/geometry_5px.gif . This happens for most values of sides. -- Edit bug report at http://bugs.php.net/?id=41717&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41717&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41717&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41717&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41717&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41717&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41717&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41717&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41717&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41717&r=support Expected behavior: http://bugs.php.net/fix.php?id=41717&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41717&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41717&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41717&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41717&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41717&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41717&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41717&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41717&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41717&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41717&r=mysqlcfg

« previous php.bugs (#113860) next »