note 108757 added to function.imagepolygon
| From: | licson0729 at gmail dot com | Date: | Wed, 23 May 2012 11:21:22 +0000 |
| Subject: | note 108757 added to function.imagepolygon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188151@lists.php.net to get a copy of this message | ||
Here's a function to draw a n-sided star:
<?php
function drawStar($img,$x,$y,$radius,$sides,$color,$spikness=0.5)
{
$point =array();
$t = 0;
for($a = 0;$a <= 360;$a += 360/($sides*2))
{
$t++;
if($t % 2 == 0)
{
$point[] = $x + ($radius * $spikness) * cos(deg2rad($a));
$point[] = $y + ($radius * $spikness) * sin(deg2rad($a));
}else{
$point[] = $x + $radius * cos(deg2rad($a));
$point[] = $y + $radius * sin(deg2rad($a));
}
}
return imagepolygon($img,$point,$sides*2,$color);
}
?>
----
Server IP: 203.169.204.174
Probable Submitter: 121.203.1.255
----
Manual Page -- http://www.php.net/manual/en/function.imagepolygon.php
Edit -- https://master.php.net/note/edit/108757
Del: integrated -- https://master.php.net/note/delete/108757/integrated
Del: useless -- https://master.php.net/note/delete/108757/useless
Del: bad code -- https://master.php.net/note/delete/108757/bad+code
Del: spam -- https://master.php.net/note/delete/108757/spam
Del: non-english -- https://master.php.net/note/delete/108757/non-english
Del: in docs -- https://master.php.net/note/delete/108757/in+docs
Del: other reasons-- https://master.php.net/note/delete/108757
Reject -- https://master.php.net/note/reject/108757
Search -- https://master.php.net/manage/user-notes.php