PHP | ImagickDraw pathMoveToAbsolute() Function Last Updated : 30 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::pathMoveToAbsolute() function is an inbuilt function in PHP which is used to start a new sub-path at the given coordinate using absolute coordinates. The current point then becomes the specified coordinate. This function is used for setting initial coordinates before starting drawing anything. Syntax: bool ImagickDraw::pathMoveToAbsolute( float $x, float $y ) Parameters:This function accepts two parameters as mentioned above and described below: $x: It specifies the x-coordinate. $y: It specifies the y-coordinate. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the ImagickDraw::pathMoveToAbsolute() 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, 'white'); // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the stroke width $draw->setStrokeWidth(30); $draw->pathStart(); // Setting the stating point to (400, 40) $draw->pathMoveToAbsolute(400, 40); // Setting the end point to (500, 40) $draw->pathLineToHorizontalAbsolute(500); $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, 'white'); // Create a new ImagickDraw object $draw = new ImagickDraw(); $color = ['blue', 'red', 'green']; // Set the stroke width $draw->setStrokeWidth(5); // Draw lines for ($x = 0; $x < 20; $x++) { $draw->setStrokeColor($color[$x % 3]); $draw->pathStart(); // Moving to next vertical line $draw->pathMoveToAbsolute($x * 40, 0); $draw->pathLineToVerticalRelative(800); $draw->pathFinish(); } for ($x = 0; $x < 20; $x++) { $draw->setStrokeColor($color[$x % 3]); $draw->pathStart(); // Moving to next horizontal line $draw->pathMoveToAbsolute(0, $x * 40); $draw->pathLineToHorizontalRelative(800); $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.pathmovetoabsolute.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw pathMoveToRelative() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw pathCurveToAbsolute() Function The ImagickDraw::pathCurveToAbsolute() function is an inbuilt function in PHP which is used to draw a cubic Bezier curve which is a parametric curve. This function draws a curve from the current point to (x, y) using beginning control point (x1, y1) to ending control point (x2, y2). In the last comm 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 PHP | ImagickDraw pathMoveToRelative() Function The ImagickDraw::pathMoveToRelative() function is an inbuilt function in PHP which is used to start a new sub-path at the given coordinate using relative coordinates. The current point then becomes the specified coordinate. This function is used for setting initial coordinates before starting drawin 2 min read PHP | ImagickDraw pathCurveToSmoothAbsolute() Function The ImagickDraw::pathCurveToSmoothAbsolute() function is an inbuilt function in PHP which is used to draw a cubic Bezier curve from the current point to (x, y) using absolute coordinates. Syntax: bool ImagickDraw::pathCurveToSmoothAbsolute ( float $x2, float $y2, float $x, float $y ) Parameters: Thi 2 min read PHP ImagickDraw pathLineToVerticalAbsolute() Function PHP ImagickDraw::pathLineToVerticalAbsolute() function is an inbuilt function in PHP that is used to draw a vertical line path from the current point to the target point using absolute coordinates. The target point then becomes the new current point. Syntax: bool ImagickDraw::pathLineToVerticalAbso 2 min read PHP | ImagickDraw pathEllipticArcAbsolute() Function The ImagickDraw::pathEllipticArcAbsolute() function is an inbuilt function in PHP which is used to draw an elliptical arc from the current point to (x, y) using absolute coordinates. Syntax: bool ImagickDraw::pathEllipticArcAbsolute( float $rx, float $ry, float $x_axis_rotation, bool $large_arc_flag 2 min read Like