The ImagickDraw::bezier() function is an inbuilt function in Imagick library of PHP which is used to draw bezier curve.
Syntax:
bool ImagickDraw::bezier( $coordinates )
Parameters: This function accepts a single parameter as the multidimensional array which takes the points through which curve is to be made.
Return Value: This function does not return any value.
Below program illustrates the ImagickDraw::bezier() function in PHP:
Program:
<?php // require_once('vendor/autoload.php'); $draw = new \ImagickDraw(); $strokeColor = new \ImagickPixel('Green'); $fillColor = new \ImagickPixel('Red'); $draw->setStrokeOpacity(1); $draw->setStrokeColor('Green'); $draw->setFillColor('Red'); $draw->setStrokeWidth(2); $pointsSet = [ [ ['x' => 10.0 * 5, 'y' => 10.0 * 5], ['x' => 30.0 * 5, 'y' => 90.0 * 5], ['x' => 25.0 * 5, 'y' => 10.0 * 5], ['x' => 50.0 * 5, 'y' => 50.0 * 5], ] ]; foreach ($pointsSet as $points) { $draw->bezier($points); } // Create an image object which draw commands // can be rendered into $imagick = new \Imagick(); $imagick->newImage(300, 300, 'White'); $imagick->setImageFormat("png"); // Render the draw commands in the // ImagickDraw object into the image. $imagick->drawImage($draw); // Send the image to the browser header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> |
Output:

Reference: http://php.net/manual/en/imagickdraw.bezier.php
Recommended Posts:
- PHP | GmagickDraw bezier() Function
- CSS | cubic-bezier() Function
- p5.js | bezier() function
- Wand bezier() function - Python
- HTML | Canvas Draw Bezier Curve
- PHP | ImagickDraw getTextAlignment() Function
- PHP | ImagickDraw scale() Function
- PHP | ImagickDraw polygon() Function
- PHP | ImagickDraw roundRectangle() Function
- PHP | ImagickDraw arc() Function
- PHP | ImagickDraw circle() Function
- PHP | ImagickDraw rectangle() Function
- PHP | ImagickDraw line() Function
- PHP | ImagickDraw point() Function
- PHP | ImagickDraw skewX() Function
- PHP | ImagickDraw setStrokeWidth() Function
- PHP | ImagickDraw translate() Function
- PHP | ImagickDraw setStrokeOpacity() Function
- PHP | ImagickDraw setGravity() Function
- PHP | ImagickDraw setFillColor() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

