note 96464 added to function.imagickdraw-rectangle
| From: | garym at binaryfarm dot com | Date: | Mon, 01 Mar 2010 00:32:20 +0000 |
| Subject: | note 96464 added to function.imagickdraw-rectangle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166452@lists.php.net to get a copy of this message | ||
<?php
// Draw a simple rectangle or three for the newbies.
// I'm trying to comment these as best I can for a non-OOP person.
// commets or criticism are welcome. Gary Melander
$image = new Imagick(); // Create a new instance an $image class
$width = 600; // Some necessary dimensions
$height = 400;
// $image class now inherits some attributes. i.e. Dimensions, bkgcolor...
$image->newImage( $width, $height, new ImagickPixel( 'lightgray' ) );
$draw = new ImagickDraw(); //Create a new drawing class (?)
$draw->setFillColor('wheat'); // Set up some colors to use for fill and outline
$draw->setStrokeColor( new ImagickPixel( 'green' ) );
$draw->rectangle( 100, 100, 200, 200 ); // Draw the rectangle
// Lets draw another
$draw->setFillColor('navy'); // Set up some colors to use for fill and outline
$draw->setStrokeColor( new ImagickPixel( 'yellow' ) );
$draw->setStrokeWidth(4);
$draw->rectangle( 150, 225, 350, 300 ); // Draw the rectangle
// and another
$draw->setFillColor('magenta'); // Set up some colors to use for fill and outline
$draw->setStrokeColor( new ImagickPixel( 'cyan' ) );
$draw->setStrokeWidth(2);
$draw->rectangle( 380, 100, 400, 350 ); // Draw the rectangle
$image->drawImage( $draw ); // Apply the stuff from the draw class to the image canvas
$image->setImageFormat('jpg'); // Give the image a format
header('Content-type: image/jpeg'); // Prepare the web browser to display an image
echo $image; // Publish it to the world!
//$image->writeImage('someimage.jpg"); // ...Or just write it to a file...
?>
----
Server IP: 69.147.83.197
Probable Submitter: 173.64.192.29
----
Manual Page -- http://www.php.net/manual/en/function.imagickdraw-rectangle.php
Edit -- https://master.php.net/note/edit/96464
Del: integrated -- https://master.php.net/note/delete/96464/integrated
Del: useless -- https://master.php.net/note/delete/96464/useless
Del: bad code -- https://master.php.net/note/delete/96464/bad+code
Del: spam -- https://master.php.net/note/delete/96464/spam
Del: non-english -- https://master.php.net/note/delete/96464/non-english
Del: in docs -- https://master.php.net/note/delete/96464/in+docs
Del: other reasons-- https://master.php.net/note/delete/96464
Reject -- https://master.php.net/note/reject/96464
Search -- https://master.php.net/manage/user-notes.php