note 89980 added to function.imagickdraw-line
| From: | Axeia at osu1 dot php dot net | Date: | Tue, 31 Mar 2009 22:53:01 +0000 |
| Subject: | note 89980 added to function.imagickdraw-line | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152669@lists.php.net to get a copy of this message | ||
A small example on how to draw lines and output it as a PNG as the documentation is quite poor at
the moment.
This example draws a bunch of lines towards the center of the image, useful if you want to make a
spiderweb, or radar-chart.. or something along those lines.
<?php
$width = 200;
$height = 200;
$border = 2;
$img = new Imagick();
$img->newImage( $width, $height, new ImagickPixel( 'lime' ) );
$draw = new ImagickDraw();
$draw->setStrokeColor( new ImagickPixel( 'black' ) );
$rx = $width / 2;
$ry = $height / 2;
$total = 2*M_PI;
$part = $total / 12;
while( $total > 0 )
{
$ex = $rx +$rx * sin( $total );
$ey = $ry +$ry * cos( $total );
$draw->line ( $rx, $ry, $ex, $ey );
$total -= $part;
}
$img->drawImage( $draw );
$img->setImageFormat( "png" );
header( "Content-Type: image/png" );
echo $img;
?>
----
Server IP: 91.199.167.18
Probable Submitter: 82.169.45.174
----
Manual Page -- http://www.php.net/manual/en/function.imagickdraw-line.php
Edit -- https://master.php.net/note/edit/89980
Del: integrated -- https://master.php.net/note/delete/89980/integrated
Del: useless -- https://master.php.net/note/delete/89980/useless
Del: bad code -- https://master.php.net/note/delete/89980/bad+code
Del: spam -- https://master.php.net/note/delete/89980/spam
Del: non-english -- https://master.php.net/note/delete/89980/non-english
Del: in docs -- https://master.php.net/note/delete/89980/in+docs
Del: other reasons-- https://master.php.net/note/delete/89980
Reject -- https://master.php.net/note/reject/89980
Search -- https://master.php.net/manage/user-notes.php