The ImagickDraw::pathCurveToQuadraticBezierRelative() function is an inbuilt function in PHP which is used to draw a quadratic Bezier curve which is nothing but a parametric quadratic curve. Only difference between pathCurveToQuadraticBezierAbsolute() and pathCurveToQuadraticBezierRelative() is that the later uses the relative control points while former uses absolute points.
Syntax:
bool ImagickDraw::pathCurveToQuadraticBezierRelative( 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 relative control point.
- $y1: It specifies y-coordinate of the relative 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::pathCurveToQuadraticBezierRelative() function in PHP:
Program 1:
| <?php  Â// Create a new imagick object $imagick= newImagick();  Â// Create a image on imagick object $imagick->newImage(800, 250, 'black');  Â// Create a new ImagickDraw object $draw= newImagickDraw();  Â$draw->setFillColor('black');  Â// Set the stroke color $draw->setStrokeColor('red');  Â// Draw curves to Quadratic Bezier Relative (with pathClose()) $draw->pathStart(); $draw->pathCurveToQuadraticBezierRelative(150, 750, 750, 250); $draw->pathClose(); $draw->pathFinish();  Â$draw->pathStart(); $draw->pathCurveToQuadraticBezierRelative(350, 50, 750, 650); $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= newImagick();  Â// Create a image on imagick object $imagick->newImage(800, 250, 'black');  Â// Create a new ImagickDraw object $draw= newImagickDraw();  Â$draw->setFillColor('black');  Â// Set the stroke color $draw->setStrokeColor('green');  Â// Draw curves (without pathClose()) $draw->pathStart(); $draw->pathCurveToQuadraticBezierRelative(150, 750, 350, 0); $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.pathcurvetoquadraticbezierrelative.php

 
                                    








