PHP | ImagickDraw pathCurveToQuadraticBezierSmoothAbsolute() Function

The ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute() function is an inbuilt function in PHP which is used to draw a quadratic Bezier curve which is a parametric curve. This function can continue a curve from a quadratic curve smoothly.
Syntax:
bool ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute( 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 the ending y-coordinate
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute() function in PHP:
Program 1:
<?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, 'black'); // Create a new ImagickDraw object $draw = new ImagickDraw(); $draw->setFillColor('black'); // Set the stroke color $draw->setStrokeColor('red'); // Draw curves to Quadratic Bezier Smooth Absolute (without pathClose()) $draw->pathStart(); $draw->pathCurveToQuadraticBezierSmoothAbsolute(3950, 250); $draw->pathCurveToQuadraticBezierSmoothAbsolute(2950, 250); $draw->pathCurveToQuadraticBezierSmoothAbsolute(390, 250); $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, 'black'); // Create a new ImagickDraw object $draw = new ImagickDraw(); $draw->setFillColor('black'); // Set the stroke color $draw->setStrokeColor('yellow'); // Draw curves to Quadratic Bezier Smooth Absolute (with pathClose()) $draw->pathStart(); $draw->pathCurveToQuadraticBezierSmoothAbsolute(3950, 250); $draw->pathCurveToQuadraticBezierSmoothAbsolute(950, 250); $draw->pathCurveToQuadraticBezierSmoothAbsolute(2390, 250); $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:
Reference: https://www.php.net/manual/en/imagickdraw.pathcurvetoquadraticbeziersmoothabsolute.php
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek 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!




