CubicBezier
Creates a cubic bezier. Cubic bezier has 2 control points.
Parameters
point1
Array of X and Y value for start point.
control1
Array of X and Y value for control point 1.
control2
Array of X and Y value for control point 2.
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\CubicBezier as GdCubicBezier;
use Grafika\Imagick\DrawingObject\CubicBezier as ImagickCubicBezier;
//...
$editorName = Grafika::detectAvailableEditor();
if('Imagick'===$editorName){
$drawingObject = new ImagickCubicBezier(array(42, 230), array(230, 237), array(42, 45), array(230, 43), '#000000');
} else if ('Gd'===$editorName) {
$drawingObject = new GdCubicBezier(array(42, 230), array(230, 237), array(42, 45), array(230, 43), '#000000');
}
$editor->draw( $image, $drawingObject );
Or let Grafika do it automatically using createDrawingObject:
use Grafika\Grafika;
//...
$drawingObject = Grafika::createDrawingObject('CubicBezier', array(42, 230), array(230, 237), array(42, 45), array(230, 43), '#000000');
$editor->draw( $image, $drawingObject ); // Draw on an image
The result of the above code: