note 96397 added to function.imagickdraw-line
| From: | GaryM at BinaryFarm dot com | Date: | Wed, 24 Feb 2010 19:48:31 +0000 |
| Subject: | note 96397 added to function.imagickdraw-line | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166339@lists.php.net to get a copy of this message | ||
<?php
// a twist on the above radar screen.
// This makes random colored spokes from a center point
$width = 400;
$height = 400;
$image = new Imagick();
$image->newImage( $width, $height, new ImagickPixel( 'wheat' ) );
$draw = new ImagickDraw();
//$draw->setStrokeColor( new ImagickPixel( 'black' ) );
$rx = $width / 2;
$ry = $height / 2;
$total = 2*M_PI;
$part = $total / 16;
while( $total > 0 )
{
$ex = $rx +$rx * sin( $total );
$ey = $ry +$ry * cos( $total );
$draw->line ( $rx, $ry, $ex, $ey );
$total -= $part;
// We need three HEX numbers to create an RGB color code like '#FF33DD'.
$draw->setStrokeColor( get_random_color() );
}
$image->drawImage( $draw );
$image->setImageFormat( "png" );
header( "Content-Type: image/png" );
echo $image;
exit;
function get_random_color() // Thanks to Greg R. for this nice little function.
{
for ($i = 0; $i<6; $i++)
{
$c .= dechex(rand(0,15));
}
return "#$c";
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 173.64.192.29
----
Manual Page -- http://www.php.net/manual/en/function.imagickdraw-line.php
Edit -- https://master.php.net/note/edit/96397
Del: integrated -- https://master.php.net/note/delete/96397/integrated
Del: useless -- https://master.php.net/note/delete/96397/useless
Del: bad code -- https://master.php.net/note/delete/96397/bad+code
Del: spam -- https://master.php.net/note/delete/96397/spam
Del: non-english -- https://master.php.net/note/delete/96397/non-english
Del: in docs -- https://master.php.net/note/delete/96397/in+docs
Del: other reasons-- https://master.php.net/note/delete/96397
Reject -- https://master.php.net/note/reject/96397
Search -- https://master.php.net/manage/user-notes.php