PHP | ImagickDraw pathLineToHorizontalRelative() Function Last Updated : 30 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The ImagickDraw::pathLineToHorizontalRelative() function is an inbuilt function in PHP which is used to draw a horizontal line path from the current point to the target point using relative coordinates. The target point then becomes the new current point. Syntax: bool ImagickDraw::pathLineToHorizontalRelative( float $x ) Parameters:This function accepts a single parameter $x which holds the x-coordinate. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the ImagickDraw::pathLineToHorizontalRelative() 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 color $draw->setStrokeColor('Green'); // Set the stroke width $draw->setStrokeWidth(5); // Draw line using pathLineToHorizontalRelative $draw->pathStart(); $draw->pathMoveToRelative(0, 100); $draw->pathLineToHorizontalRelative(1000); $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', 'yellow', 'orange', 'brown', 'pink']; // Set the stroke width $draw->setStrokeWidth(5); // Draw lines for ($x = 0; $x < 7; $x++) { $draw->setStrokeColor($color[$x]); $draw->pathStart(); $draw->pathMoveToRelative(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.pathlinetohorizontalrelative.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw pathLineToHorizontalAbsolute() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw pathLineToHorizontalAbsolute() Function The ImagickDraw::pathLineToHorizontalAbsolute() function is an inbuilt function in PHP which is used to draw a horizontal line path from the current point to the target point using absolute coordinates. The target point then becomes the new current point. The current point can also be alternatively 2 min read PHP | ImagickDraw pathLineToVerticalRelative() Function The ImagickDraw::pathLineToVerticalRelative() function is an inbuilt function in PHP which is used draw a vertical line path from the current point to the target point using relative coordinates. The target point then becomes the new current point. Syntax: bool ImagickDraw::pathLineToVerticalRelativ 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 pathCurveToSmoothRelative() Function The ImagickDraw::pathCurveToSmoothRelative() function is an inbuilt function in PHP which is used to draw a cubic Bezier curve from the current point to (x,y) using relative coordinates. Syntax: bool ImagickDraw::pathCurveToSmoothRelative( float $x2, float $y2, float $x, float $y ) Parameters: This 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 pathEllipticArcRelative() Function The ImagickDraw::pathEllipticArcRelative() function is an inbuilt function in PHP which is used to draw an elliptical arc from the current point to (x, y) using relative coordinates. Syntax: bool ImagickDraw::pathEllipticArcRelative( float $rx, float $ry, float $x_axis_rotation, bool $large_arc_flag 2 min read Like