1--TEST--
2Test ImagickDraw, setStrokeMiterLimit
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 setStrokeMiterLimit($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15
16    $draw->setStrokeColor($strokeColor);
17    $draw->setStrokeOpacity(0.6);
18    $draw->setFillColor($fillColor);
19    $draw->setStrokeWidth(10);
20
21    $yOffset = 100;
22
23    $draw->setStrokeLineJoin(\Imagick::LINEJOIN_MITER);
24
25    for ($y = 0; $y < 3; $y++) {
26
27        $draw->setStrokeMiterLimit(40 * $y);
28
29        $points = array(
30            array('x' => 22 * 3, 'y' => 15 * 4 + $y * $yOffset),
31            array('x' => 20 * 3, 'y' => 20 * 4 + $y * $yOffset),
32            array('x' => 70 * 5, 'y' => 45 * 4 + $y * $yOffset),
33        );
34
35        $draw->polygon($points);
36    }
37
38    $image = new \Imagick();
39    $image->newImage(500, 500, $backgroundColor);
40    $image->setImageFormat("png");
41    $image->drawImage($draw);
42
43    $image->setImageType(\Imagick::IMGTYPE_PALETTE);
44    //TODO - this should either be everywhere or nowhere
45    $image->setImageCompressionQuality(100);
46    $image->stripImage();
47
48    $bytes = $image->getImageBlob();
49    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
50}
51
52setStrokeMiterLimit($strokeColor, $fillColor, $backgroundColor) ;
53echo "Ok";
54?>
55--EXPECTF--
56Ok