1--TEST-- 2Test ImagickDraw, bezier 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 bezier($strokeColor, $fillColor, $backgroundColor) { 13 14 $draw = new \ImagickDraw(); 15 16 $strokeColor = new \ImagickPixel($strokeColor); 17 $fillColor = new \ImagickPixel($fillColor); 18 19 $draw->setStrokeOpacity(1); 20 $draw->setStrokeColor($strokeColor); 21 $draw->setFillColor($fillColor); 22 23 $draw->setStrokeWidth(2); 24 25 $smoothPointsSet = array( 26 array( 27 array('x' => 10.0 * 5, 'y' => 10.0 * 5), 28 array('x' => 30.0 * 5, 'y' => 90.0 * 5), 29 array('x' => 25.0 * 5, 'y' => 10.0 * 5), 30 array('x' => 50.0 * 5, 'y' => 50.0 * 5), 31 ), 32 array( 33 array('x' => 50.0 * 5, 'y' => 50.0 * 5), 34 array('x' => 75.0 * 5, 'y' => 90.0 * 5), 35 array('x' => 70.0 * 5, 'y' => 10.0 * 5), 36 array('x' => 90.0 * 5, 'y' => 40.0 * 5), 37 ), 38 ); 39 40 foreach ($smoothPointsSet as $points) { 41 $draw->bezier($points); 42 } 43 44 45 $disjointPoints = array( 46 array( 47 array('x' => 10 * 5, 'y' => 10 * 5), 48 array('x' => 30 * 5, 'y' => 90 * 5), 49 array('x' => 25 * 5, 'y' => 10 * 5), 50 array('x' => 50 * 5, 'y' => 50 * 5), 51 ), 52 array( 53 array('x' => 50 * 5, 'y' => 50 * 5), 54 array('x' => 80 * 5, 'y' => 50 * 5), 55 array('x' => 70 * 5, 'y' => 10 * 5), 56 array('x' => 90 * 5, 'y' => 40 * 5), 57 ) 58 ); 59 $draw->translate(0, 200); 60 61 foreach ($disjointPoints as $points) { 62 $draw->bezier($points); 63 } 64 65 //Create an image object which the draw commands can be rendered into 66 $imagick = new \Imagick(); 67 $imagick->newImage(500, 500, $backgroundColor); 68 $imagick->setImageFormat("png"); 69 70 //Render the draw commands in the ImagickDraw object 71 //into the image. 72 $imagick->drawImage($draw); 73 74 //Send the image to the browser 75 $bytes = $imagick->getImageBlob(); 76 if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 77} 78 79bezier($strokeColor, $fillColor, $backgroundColor) ; 80echo "Ok"; 81?> 82--EXPECTF-- 83Ok