1--TEST--
2Test ImagickDraw, polygon
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 polygon($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15
16    $draw->setStrokeOpacity(1);
17    $draw->setStrokeColor($strokeColor);
18    $draw->setStrokeWidth(4);
19
20    $draw->setFillColor($fillColor);
21
22    $points = array(
23        array('x' => 40 * 5, 'y' => 10 * 5),
24        array('x' => 20 * 5, 'y' => 20 * 5),
25        array('x' => 70 * 5, 'y' => 50 * 5),
26        array('x' => 60 * 5, 'y' => 15 * 5),
27    );
28
29    $draw->polygon($points);
30
31    $image = new \Imagick();
32    $image->newImage(500, 300, $backgroundColor);
33    $image->setImageFormat("png");
34    $image->drawImage($draw);
35
36    $bytes = $image->getImageBlob();
37    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
38}
39
40polygon($strokeColor, $fillColor, $backgroundColor) ;
41echo "Ok";
42?>
43--EXPECTF--
44Ok