1--TEST--
2Test ImagickDraw, pathCurveToQuadraticBezierAbsolute
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5--FILE--
6<?php
7
8$backgroundColor = 'rgb(225, 225, 225)';
9$strokeColor = 'rgb(0, 0, 0)';
10$fillColor = 'DodgerBlue2';
11
12function pathCurveToQuadraticBezierAbsolute($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15
16    $draw->setStrokeOpacity(1);
17    $draw->setStrokeColor($strokeColor);
18    $draw->setFillColor($fillColor);
19
20    $draw->setStrokeWidth(2);
21    $draw->setFontSize(72);
22
23    $draw->pathStart();
24    $draw->pathMoveToAbsolute(50,250);
25
26    // This specifies a quadratic bezier curve with the current position as the start
27    // point, the control point is the first two params, and the end point is the last two params.
28    $draw->pathCurveToQuadraticBezierAbsolute(
29        150,50,
30        250,250
31    );
32
33    // This specifies a quadratic bezier curve with the current position as the start
34    // point, the control point is mirrored from the previous curves control point
35    // and the end point is defined by the x, y values.
36    $draw->pathCurveToQuadraticBezierSmoothAbsolute(
37        450,250
38    );
39
40    // This specifies a quadratic bezier curve with the current position as the start
41    // point, the control point is mirrored from the previous curves control point
42    // and the end point is defined relative from the current position by the x, y values.
43    $draw->pathCurveToQuadraticBezierSmoothRelative(
44        200,-100
45    );
46
47    $draw->pathFinish();
48
49    $imagick = new \Imagick();
50    $imagick->newImage(700, 500, $backgroundColor);
51    $imagick->setImageFormat("png");
52
53    $imagick->drawImage($draw);
54
55    $bytes = $imagick->getImageBlob();
56    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
57
58}
59
60pathCurveToQuadraticBezierAbsolute($strokeColor, $fillColor, $backgroundColor) ;
61echo "Ok";
62?>
63--EXPECTF--
64Ok