Saturday, July 25, 2026
HomeLanguagesPHP | ImagickDraw pathCurveToQuadraticBezierSmoothRelative() Function

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
  
// 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('brown');
  
// Draw curves to Quadratic Bezier Smooth Relative (without pathClose())
$draw->pathStart();
$draw->pathCurveToQuadraticBezierSmoothRelative(950, 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('pink');
  
// Draw curves to Quadratic Bezier Smooth Relative (with pathClose())
$draw->pathStart();
$draw->pathCurveToQuadraticBezierSmoothRelative(3950, 250);
$draw->pathCurveToQuadraticBezierSmoothRelative(950, 250);
$draw->pathCurveToQuadraticBezierSmoothRelative(-2000, 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.pathcurvetoquadraticbeziersmoothrelative.php

RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32520 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6903 POSTS0 COMMENTS
Nicole Veronica
12017 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12115 POSTS0 COMMENTS
Shaida Kate Naidoo
7023 POSTS0 COMMENTS
Ted Musemwa
7265 POSTS0 COMMENTS
Thapelo Manthata
6980 POSTS0 COMMENTS
Umr Jansen
6972 POSTS0 COMMENTS