1--TEST-- 2Test ImagickPixel, setColorValueQuantum 3--SKIPIF-- 4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> 5--FILE-- 6<?php 7 8 9function setColorValueQuantum() { 10 $image = new \Imagick(); 11 12 $quantumRange = $image->getQuantumRange(); 13 14 $draw = new \ImagickDraw(); 15 $color = new \ImagickPixel('blue'); 16 $color->setcolorValueQuantum(\Imagick::COLOR_RED, (int)(128 * $quantumRange['quantumRangeLong'] / 256)); 17 18 $draw->setstrokewidth(1.0); 19 $draw->setStrokeColor($color); 20 $draw->setFillColor($color); 21 $draw->rectangle(200, 200, 300, 300); 22 23 $image->newImage(500, 500, "SteelBlue2"); 24 $image->setImageFormat("png"); 25 26 $image->drawImage($draw); 27 28 $bytes = $image->getImageBlob(); 29 if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 30} 31 32setColorValueQuantum() ; 33echo "Ok"; 34?> 35--EXPECTF-- 36Ok 37