Imagick draw functions page 1

Annotation
Draws text on the image.
Annotation example

bool ImagickDraw::annotation ( float $x , float $y , string $text )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor'Black' );
$draw->setFont 'handsean.ttf' );
$draw->setFontSize 30 );
$draw->setGravity (Imagick::GRAVITY_CENTER);
$draw->annotation00'Rubblewebs');
$im->drawImage$draw );
$im->writeImage('annotation.jpg'); 
$im->destroy();
 
?>
Arc
Draws an arc falling within a specified bounding rectangle on the image.
Arc example

bool ImagickDraw::arc ( float $sx , float $sy , float $ex , float $ey , float $sd , float $ed )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->arc66,50200,1500,135 );
$im->drawImage$draw );
$im->writeImage('draw_arc.jpg'); 
$im->destroy();
 
?>
Bezier
Draws a bezier curve
Bezier example

bool ImagickDraw::bezier ( array $coordinates )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$points = array(
array( 
'x' => 1'y' => 150 ),
array( 
'x' => 0'y' => ),  
array( 
'x' => 199'y' => 150 ), 
array( 
'x' => 199'y' => ));
$draw = new ImagickDraw();
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->bezier$points );
$im->drawImage$draw );
$im->writeImage('bezier.jpg'); 
$im->destroy();
 
?>
Circle
Drawers a circle
Circle example
Another Circle example

bool ImagickDraw::circle ( float $ox , float $oy , float $px , float $py )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->circle1007510010 );
$im->drawImage$draw );
$im->writeImage('draw_circle_filled.jpg'); 
$im->destroy();


$im = new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->circle1007510010 );
$im->drawImage$draw );
$im->writeImage('draw_circle_empty.jpg'); 
$im->destroy();
 
?>
Color
Draws color on image using the current fill color, starting at specified position, and using specified paint method.
Color example

bool ImagickDraw::color ( float $x , float $y , int $paintMethod )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('Blue');
$draw->color5050);
$im->drawImage$draw );
$im->writeImage('color.jpg'); 
$im->destroy();
 
?>


1 - imagick::PAINT_POINT
2 - imagick::PAINT_REPLACE
3 - imagick::PAINT_FLOODFILL
4 - imagick::PAINT_FILLTOBORDER
5 - imagick::PAINT_RESET
Not working as expected
Line
Draws a line on the image using the current stroke color, stroke opacity, and stroke width.
Line example

bool ImagickDraw::line ( float $sx , float $sy , float $ex , float $ey )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->line10,140190,10 );
$im->drawImage$draw );
$im->writeImage('draw_line.jpg'); 
$im->destroy();
 
?>
Path close
Adds a path element to the current path
Not working


bool ImagickDraw::pathClose ( void )

<?php /*
$im = new Imagick();
$im->newImage( 200, 150, 'NavajoWhite' );
$draw = new ImagickDraw();
$points = array(
array( 'x' => 1, 'y' => 150 ),
array( 'x' => 10, 'y' => 0 ),  
array( 'x' => 189, 'y' => 150 ), 
array( 'x' => 199, 'y' => 0 ));
$draw->setFillColor('none');
$draw->setStrokeColor( 'Black' );
$draw->setStrokeWidth(1); 
$draw->polyline( $points );
$draw->pathClose ();
$im->drawImage( $draw );
$im->writeImage('pathClose.jpg'); 
$im->destroy();
*/ 
?>
Point
Draws a point using the current stroke color and stroke thickness at the specified coordinates.
Point example

bool ImagickDraw::point ( float $x , float $y )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('Black');
$draw->point10075 );
$im->drawImage$draw );
$im->writeImage('draw_point.jpg'); 
$im->destroy();
 
?>
Polygon
Draws a polygon using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates.
Polygon example

bool ImagickDraw::polygon ( array $coordinates )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$points = array(
array( 
'x' => 100'y' => 15 ),
array( 
'x' => 150'y' => 65 ),  
array( 
'x' => 120'y' => 120 ), 
array( 
'x' => 80'y' => 120 ));
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(2); 
$draw->polygon$points );
$im->drawImage$draw );
$im->writeImage('draw_polygon.jpg'); 
$im->destroy();
 
?>
Polyline
Draws a polyline using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates.
Polyline example

bool ImagickDraw::polyline ( array $coordinates )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$points = array(
array( 
'x' => 1'y' => 150 ),
array( 
'x' => 10'y' => ),  
array( 
'x' => 189'y' => 150 ), 
array( 
'x' => 199'y' => ));
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->polyline$points );
$im->drawImage$draw );
$im->writeImage('draw_polyline.jpg'); 
$im->destroy();
 
?>
Rectangle
Draws a rectangle given two coordinates and using the current stroke, stroke width, and fill settings.
Rectangle example

bool ImagickDraw::rectangle ( float $x1 , float $y1 , float $x2 , float $y2 )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->rectangle2020180130 );
$im->drawImage$draw );
$im->writeImage('rectangle.jpg'); 
$im->destroy();
 
?>
Rotate
Applies the specified rotation to the current coordinate space.
Rotate example

bool ImagickDraw::rotate ( float $degrees )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->roundRectangle2020180130,1010 );
$draw->rotate(10);
$draw->roundRectangle2020180130,1010 );
$draw->rotate(10);
$draw->roundRectangle2020180130,1010 );
$im->drawImage$draw );
$im->writeImage('rotate.jpg'); 
$im->destroy();
 
?>
Round rectangle
Draws a rounded rectangle
Round rectangle example

bool ImagickDraw::roundRectangle ( float $x1 , float $y1 , float $x2 , float $y2 , float $rx , float $ry )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->roundRectangle2020180130,1010 );
$im->drawImage$draw );
$im->writeImage('roundRectangle.jpg'); 
$im->destroy();
 
?>
Scale
Adjusts the scaling factor to apply in the horizontal and vertical directions to the current coordinate space.
Scale example

bool ImagickDraw::scale ( float $x , float $y )

<?php 
$im 
= new Imagick();
$im->newImage200150'NavajoWhite' );
$draw = new ImagickDraw();
$draw->setFillColor('none');
$draw->setStrokeColor'Black' );
$draw->setStrokeWidth(1); 
$draw->rectangle2020180130 );
$draw->scale0.50.5 );
$draw->rectangle2020180130 );
$im->drawImage$draw );
$im->writeImage('scale.jpg'); 
$im->destroy();
 
?>