note 100419 added to function.imageline
| From: | kingofnumbers at windowslive dot com | Date: | Thu, 14 Oct 2010 17:39:04 +0000 |
| Subject: | note 100419 added to function.imageline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173227@lists.php.net to get a copy of this message | ||
a function to draw a circle :)
<?php
function imagecircle($source,$r,$x,$y,$color){
for($i = 0;$i<=2*pi();$i+=(pi()/180)){
imageline($source,cos($i)*$r+$x,sin($i)*$r+$y,
cos($i+(pi()/180))*$r+$x,sin($i+(pi()/180))*$r+$y,$color);
}
}
?>
Ex:
<?php
function imagecircle($source,$r,$x,$y,$color){
for($i = 0;$i<=2*pi();$i+=(pi()/180)){
imageline($source,cos($i)*$r+$x,sin($i)*$r+$y,
cos($i+(pi()/180))*$r+$x,sin($i+(pi()/180))*$r+$y,$color);
}
}
$im_width = 200;
$im_height = 200;
$source = imagecreate($im_width,$im_height);
$w = imagecolorallocate($source,235 ,235,235);
$blue = imagecolorallocate($source,00,00,255);
imagecircle($source,50,50,50,$blue);
imagecircle($source,50,150,50,$blue);
imagecircle($source,50,50,150,$blue);
imagecircle($source,50,150,150,$blue);
header("Content-Type: image/png");
imagepng($source);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 188.139.143.115
----
Manual Page -- http://www.php.net/manual/en/function.imageline.php
Edit -- https://master.php.net/note/edit/100419
Del: integrated -- https://master.php.net/note/delete/100419/integrated
Del: useless -- https://master.php.net/note/delete/100419/useless
Del: bad code -- https://master.php.net/note/delete/100419/bad+code
Del: spam -- https://master.php.net/note/delete/100419/spam
Del: non-english -- https://master.php.net/note/delete/100419/non-english
Del: in docs -- https://master.php.net/note/delete/100419/in+docs
Del: other reasons-- https://master.php.net/note/delete/100419
Reject -- https://master.php.net/note/reject/100419
Search -- https://master.php.net/manage/user-notes.php