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
$imagick = new Imagick();
$imagick ->newImage(800, 250, '#7441e0' );
$draw = new ImagickDraw();
$draw ->setFillColor( '#2fceeb' );
$draw ->setStrokeColor( '#c27230' );
$draw ->setStrokeWidth(15);
$draw ->pathStart();
$draw ->pathEllipticArcRelative(120, 9250,
210, false, true, 300, 400);
$draw ->pathClose();
$draw ->pathFinish();
$imagick ->drawImage( $draw );
$imagick ->setImageFormat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Program 2:
<?php
$imagick = new Imagick();
$imagick ->newImage(800, 250, '#7441e0' );
$draw = new ImagickDraw();
$draw ->setFillColor( '#2fceeb' );
$draw ->setStrokeColor( '#c27230' );
$draw ->setStrokeWidth(15);
$draw ->pathStart();
$draw ->pathEllipticArcRelative(120,
50, 10, true, true, 300, 400);
$draw ->pathFinish();
$imagick ->drawImage( $draw );
$imagick ->setImageFormat( 'png' );
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagickdraw.pathellipticarcrelative.php
Last Updated :
20 Dec, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...