Saturday, October 11, 2025
HomeLanguagesPHP | ImagickDraw pathEllipticArcRelative() Function

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, bool $sweep_flag, float $x )

Parameters: This function accepts seven parameters as mentioned above and described below:

  • $rx: It specifies the x-radius.
  • $ry: It specifies the y-radius
  • $x_axis_rotation: It specifies x-axis rotation
  • $large_arc_flag: It specifies whether to draw the larger of the available arcs.
  • $sweep_flag: It specifies whether to draw the arc matching a clock-wise rotation.
  • $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 programs illustrate the ImagickDraw::pathEllipticArcRelative() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagick = new Imagick();
  
// Create a image on imagick object
$imagick->newImage(800, 250, '#7441e0');
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
$draw->setFillColor('#2fceeb');
  
// Set the stroke color
$draw->setStrokeColor('#c27230');
  
// Set the stroke width
$draw->setStrokeWidth(15);
  
// Draw elliptic arc
$draw->pathStart();
$draw->pathEllipticArcRelative(120, 9250,
               210, false, true, 300, 400);
$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
  
// Create a new imagick object
$imagick = new Imagick();
  
// Create a image on imagick object
$imagick->newImage(800, 250, '#7441e0');
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
$draw->setFillColor('#2fceeb');
  
// Set the stroke color
$draw->setStrokeColor('#c27230');
  
// Set the stroke width
$draw->setStrokeWidth(15);
  
// Draw elliptic arc
$draw->pathStart();
$draw->pathEllipticArcRelative(120,
         50, 10, true, true, 300, 400);
$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.pathellipticarcrelative.php

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32350 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6719 POSTS0 COMMENTS
Nicole Veronica
11881 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6839 POSTS0 COMMENTS
Ted Musemwa
7101 POSTS0 COMMENTS
Thapelo Manthata
6794 POSTS0 COMMENTS
Umr Jansen
6794 POSTS0 COMMENTS