QuadraticBezier

Creates a quadratic bezier. Quadratic bezier has 1 control point.

Parameters
point1

Array of X and Y value for start point.

control

Array of X and Y value for control point.

point2

Array of X and Y value for end point.

color

Color of the curve. Accepts hex string or a Color object. Defaults to black.

Examples

Detect and create based on available editor:

use Grafika\Grafika;
use Grafika\Gd\DrawingObject\QuadraticBezier as GdQuadraticBezier;
use Grafika\Imagick\DrawingObject\QuadraticBezier as ImagickQuadraticBezier;

//...

$editorName = Grafika::detectAvailableEditor();
if('Imagick'===$editorName){
    $drawingObject = new ImagickQuadraticBezier(array(70, 250), array(20, 110), array(220, 60), '#FF0000');
} else if ('Gd'===$editorName) {
    $drawingObject = new GdQuadraticBezier(array(70, 250), array(20, 110), array(220, 60), '#FF0000');
}
$editor->draw( $image, $drawingObject );

Or let Grafika do it automatically using createDrawingObject:

use Grafika\Grafika;

//...

$drawingObject = Grafika::createDrawingObject('QuadraticBezier', array(70, 250), array(20, 110), array(220, 60), '#FF0000');
$editor->draw( $image, $drawingObject ); // Draw on an image 

The result of the above code:

testQuadraticBezier