PHP | ImagickDraw pathCurveToQuadraticBezierSmoothRelative() Function
The ImagickDraw::pathCurveToQuadraticBezierSmoothRelative() function is an inbuilt function in PHP which is used to draw a quadratic Bezier curve (using relative coordinates) from the current point to (x, y).
Syntax:
bool ImagickDraw::pathCurveToQuadraticBezierSmoothRelative( float $x, float $y )
Parameters:This function accepts two parameters as mentioned above and described below:
- $x: It specifies the ending x-coordinate.
- $y: It specifies ending y-coordinate.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the ImagickDraw::pathCurveToQuadraticBezierSmoothRelative() function in PHP:
Program 1:
<?php
$imagick = new Imagick();
$imagick ->newImage(800, 250, 'black' );
$draw = new ImagickDraw();
$draw ->setFillColor( 'black' );
$draw ->setStrokeColor( 'brown' );
$draw ->pathStart();
$draw ->pathCurveToQuadraticBezierSmoothRelative(950, 250);
$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, 'black' );
$draw = new ImagickDraw();
$draw ->setFillColor( 'black' );
$draw ->setStrokeColor( 'pink' );
$draw ->pathStart();
$draw ->pathCurveToQuadraticBezierSmoothRelative(3950, 250);
$draw ->pathCurveToQuadraticBezierSmoothRelative(950, 250);
$draw ->pathCurveToQuadraticBezierSmoothRelative(-2000, 250);
$draw ->pathClose();
$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.pathcurvetoquadraticbeziersmoothrelative.php
Last Updated :
23 Dec, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...