PHP | ImagickDraw pathFinish() Function Last Updated : 20 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::pathFinish() function is an inbuilt function in PHP which is used to terminate the current path. This is required when multiple paths are to be drawn in the image. Syntax: bool ImagickDraw::pathFinish( void ) Parameters: This function doesn’t accepts any parameter. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below programs illustrate the ImagickDraw::pathFinish() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, '#1a65f0'); // Create a new ImagickDraw object $draw = new ImagickDraw(); $draw->setFillColor('#2fceeb'); // Set the stroke color $draw->setStrokeColor('black'); // Set the stroke width $draw->setStrokeWidth(15); // Create a path $draw->pathStart(); $draw->pathMoveToAbsolute(50, 50); $draw->pathLineToAbsolute(100, 50); $draw->pathLineToRelative(0, 50); $draw->pathLineToHorizontalRelative(-50); $draw->pathFinish(); // Create another path $draw->pathStart(); $draw->pathMoveToAbsolute(50, 50); $draw->pathMoveToRelative(300, 0); $draw->pathLineToRelative(50, 0); $draw->pathLineToVerticalRelative(50); $draw->pathLineToHorizontalAbsolute(350); $draw->pathclose(); $draw->pathFinish(); // Render the draw commands $imagick->drawImage($draw); // Show the output $imagick->setImageFormat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, '#1a65f0'); // Create a new ImagickDraw object $draw = new ImagickDraw(); $draw->setFillColor('red'); // Set the stroke color $draw->setStrokeColor('black'); // Set the stroke width $draw->setStrokeWidth(1); // Create a path $draw->pathStart(); $draw->pathMoveToAbsolute(50, 50); $draw->pathLineToAbsolute(100, 150); $draw->pathLineToRelative(0, 50); $draw->pathLineToHorizontalRelative(-50); $draw->pathFinish(); $x = 0; for ($x; $x < 10; $x++) { // Create another path $draw->pathStart(); $draw->pathMoveToAbsolute(50, 150); $draw->pathMoveToRelative($x * 100, 0); $draw->pathLineToRelative(50, 0); $draw->pathLineToVerticalRelative(50); $draw->pathLineToHorizontalAbsolute(350); $draw->pathclose(); $draw->pathFinish(); } // Render the draw commands $imagick->drawImage($draw); // Show the output $imagick->setImageFormat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagickdraw.pathfinish.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw pop() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw pathStart() Function The ImagickDraw::pathStart() function is an inbuilt function in PHP which is used to declare the start of a path drawing list. Later, pathFinish() function is used to terminate this list. Syntax: bool ImagickDraw::pathStart( void ) Parameters: This function doesnât accept any parameters. Return Valu 2 min read PHP | ImagickDraw pathClose() Function The ImagickDraw::pathClose() function is an inbuilt function in PHP which is used to add a path element to the current path which closes the current subpath by drawing a straight line. In simple words, it is used to completely apply a stroke to all the edges. Syntax: bool ImagickDraw::pathClose( voi 2 min read PHP | ImagickDraw line() Function The ImagickDraw::line() function is an inbuilt function in Imagick library of PHP which is used to draw a line. This function draw the line using the current stroke color, stroke opacity, and stroke width. Syntax:  bool ImagickDraw::line( $sx, $sy, $ex, $ey ) Parameters: This function accepts four 1 min read PHP | ImagickDraw pop() Function The ImagickDraw::pop() function is an inbuilt function in PHP which is used to destroy the current ImagickDraw in the stack and returns the previously pushed ImagickDraw. For every pop() function there must have already been an equivalent push() function. Syntax: bool ImagickDraw::pop( void ) Parame 2 min read PHP | ImagickDraw pathLineToRelative() Function The ImagickDraw::pathLineToRelative() function is an inbuilt function in PHP which is used to draw a line path from the current point to the given coordinate using relative coordinates. Then the coordinate becomes the new current point. The initial point can be set using pathMoveToRelative() functio 2 min read PHP | ImagickDraw pathLineToAbsolute() Function The ImagickDraw::pathLineToAbsolute() function is an inbuilt function in PHP which is used to draw a line path from the current point to the given coordinate using absolute coordinates. The coordinate then becomes the new current point. The initial point can be set using pathMoveToAbsolute() functio 2 min read Like