1--TEST-- 2Test ImagickDraw, rectangle 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 rectangle($strokeColor, $fillColor, $backgroundColor) { 13 $draw = new \ImagickDraw(); 14 $strokeColor = new \ImagickPixel($strokeColor); 15 $fillColor = new \ImagickPixel($fillColor); 16 17 $draw->setStrokeColor($strokeColor); 18 $draw->setFillColor($fillColor); 19 $draw->setStrokeOpacity(1); 20 $draw->setStrokeWidth(2); 21 22 $draw->rectangle(200, 200, 300, 300); 23 $imagick = new \Imagick(); 24 $imagick->newImage(500, 500, $backgroundColor); 25 $imagick->setImageFormat("png"); 26 27 $imagick->drawImage($draw); 28 29 $bytes = $imagick->getImageBlob(); 30 if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 31} 32 33rectangle($strokeColor, $fillColor, $backgroundColor) ; 34echo "Ok"; 35?> 36--EXPECTF-- 37Ok