note 89978 added to function.imagickdraw-ellipse

From: Date: Tue, 31 Mar 2009 22:10:52 +0000
Subject: note 89978 added to function.imagickdraw-ellipse
Groups: php.notes 
Request: Send a blank email to php-notes+get-152666@lists.php.net to get a copy of this message
<? /** * Please note that if you use a stroke. ( Imagick::setStrokeWidth( 2 ) ) the * stroke is drawn outside the ellipse dimensions. * * @param float $ox - Offset X, distance from the center of the ellipse till the left border of the image * @param float $oy - Offset Y, distance from the center of the ellipse till the top of the image * @param float $rx - X radius * @param float $ry - Y radius * @param float float $start - Starting angle in degrees. * @param float float $end - End angle in degrees. * */ ImagickDraw::ellipse( float $ox , float $oy , float $rx , float $ry , float $start , float $end ); ?> Example of drawing a full ellipse (from 0, 360) and outputting it as a PNG. Do note, that this is by default anti-aliased unlike the GD functions which only support it on lines that aren't on a transparent background. <?php $width = 200; $height = 100; $border = 2; $img = new Imagick(); $img->newImage( $width, $height, new ImagickPixel( 'transparent' ) ); $draw = new ImagickDraw(); $draw->setStrokeColor( new ImagickPixel( 'black' ) ); $draw->setStrokeWidth( 2 ); $draw->setFillColor( new ImagickPixel( 'transparent' ) ); //Substract the border from the radius so it doesn't fall outside the screen. $draw->ellipse( $width/2, $height/2, ($width/2)-$border, ($height/2)-$border, 0, 360 ); $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-ellipse.php Edit -- https://master.php.net/note/edit/89978 Del: integrated -- https://master.php.net/note/delete/89978/integrated Del: useless -- https://master.php.net/note/delete/89978/useless Del: bad code -- https://master.php.net/note/delete/89978/bad+code Del: spam -- https://master.php.net/note/delete/89978/spam Del: non-english -- https://master.php.net/note/delete/89978/non-english Del: in docs -- https://master.php.net/note/delete/89978/in+docs Del: other reasons-- https://master.php.net/note/delete/89978 Reject -- https://master.php.net/note/reject/89978 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152666) next »