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