note 67420 added to function.imageellipse

From: Date: Wed, 07 Jun 2006 20:36:59 +0000
Subject: note 67420 added to function.imageellipse
Groups: php.notes 
Request: Send a blank email to php-notes+get-113651@lists.php.net to get a copy of this message
This is an optimised and bug fixed version of nojer at yahoo dot com's rotatedellipse function. I've changed it so that the arguments are compatible with imageellipse. See notes on imagearc for original version. <?php function rotatedellipse($im, $cx, $cy, $width, $height, $rotateangle, $colour, $filled=false) { // modified here from nojer's version // Rotates from the three o-clock position clockwise with increasing angle. // Arguments are compatible with imageellipse. $width=$width/2; $height=$height/2; // This affects how coarse the ellipse is drawn. $step=3; $cosangle=cos(deg2rad($rotateangle)); $sinangle=sin(deg2rad($rotateangle)); // $px and $py are initialised to values corresponding to $angle=0. $px=$width * $cosangle; $py=$width * $sinangle; for ($angle=$step; $angle<=(180+$step); $angle+=$step) { $ox = $width * cos(deg2rad($angle)); $oy = $height * sin(deg2rad($angle)); $x = ($ox * $cosangle) - ($oy * $sinangle); $y = ($ox * $sinangle) + ($oy * $cosangle); if ($filled) { triangle($im, $cx, $cy, $cx+$px, $cy+$py, $cx+$x, $cy+$y, $colour); triangle($im, $cx, $cy, $cx-$px, $cy-$py, $cx-$x, $cy-$y, $colour); } else { imageline($im, $cx+$px, $cy+$py, $cx+$x, $cy+$y, $colour); imageline($im, $cx-$px, $cy-$py, $cx-$x, $cy-$y, $colour); } $px=$x; $py=$y; } } function triangle($im, $x1,$y1, $x2,$y2, $x3,$y3, $colour) { $coords = array($x1,$y1, $x2,$y2, $x3,$y3); imagefilledpolygon($im, $coords, 3, $colour); } ?> ---- Server IP: 84.18.202.180 Probable Submitter: 62.253.128.11 (proxied: 82.6.100.138) ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.imageellipse.php Edit -- http://master.php.net/note/edit/67420 Del: integrated -- http://master.php.net/note/delete/67420/integrated Del: useless -- http://master.php.net/note/delete/67420/useless Del: bad code -- http://master.php.net/note/delete/67420/bad+code Del: spam -- http://master.php.net/note/delete/67420/spam Del: non-english -- http://master.php.net/note/delete/67420/non-english Del: in docs -- http://master.php.net/note/delete/67420/in+docs Del: other reasons-- http://master.php.net/note/delete/67420 Reject -- http://master.php.net/note/reject/67420 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#113651) next »