PHP | ImagickDraw pathCurveToQuadraticBezierAbsolute() Function
The ImagickDraw::pathCurveToQuadraticBezierAbsolute() function is an inbuilt function in PHP which is used to draw a quadratic Bezier curve which is nothing but a parametric quadratic curve.
Syntax:
bool ImagickDraw::pathCurveToQuadraticBezierAbsolute( float $x1, float $y1, float $x, float $y )
Parameters: This function accepts four parameters as mentioned above and described below:
- $x1: It specifies x-coordinate of the control point.
- $y1: It specifies y-coordinate of the control point.
- $x: It specifies x-coordinate of the end point.
- $y: It specifies y-coordinate of the end point.
Return Value: This function returns TRUE on success.
Below programs illustrate the ImagickDraw::pathCurveToQuadraticBezierAbsolute() function in PHP:
Program 1:
<?php
$imagick = new Imagick();
$imagick ->newImage(800, 250, 'white' );
$draw = new ImagickDraw();
$draw ->setFillColor( 'white' );
$draw ->setStrokeColor( 'red' );
$draw ->pathStart();
$draw ->pathCurveToQuadraticBezierAbsolute(150, 250, 950, 250);
$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, 'white' );
$draw = new ImagickDraw();
$draw ->setFillColor( 'white' );
$draw ->setStrokeColor( 'blue' );
$draw ->pathStart();
$draw ->pathCurveToQuadraticBezierAbsolute(350, 250, 750, 250);
$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.pathcurvetoquadraticbezierabsolute.php
Last Updated :
17 Dec, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...