1--TEST--
2Test ImagickDraw, setStrokeDashOffset
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 setStrokeDashOffset($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15
16    $draw->setStrokeColor($strokeColor);
17    $draw->setFillColor($fillColor);
18    $draw->setStrokeWidth(4);
19    $draw->setStrokeDashArray(array(20, 20));
20    $draw->setStrokeDashOffset(0);
21    $draw->rectangle(100, 50, 225, 175);
22
23    //Start the dash effect halfway through the solid portion
24    $draw->setStrokeDashOffset(10);
25    $draw->rectangle(275, 50, 400, 175);
26
27    //Start the dash effect on the space portion
28    $draw->setStrokeDashOffset(20);
29    $draw->rectangle(100, 200, 225, 350);
30    $draw->setStrokeDashOffset(5);
31    $draw->rectangle(275, 200, 400, 350);
32
33    $image = new \Imagick();
34    $image->newImage(500, 400, $backgroundColor);
35    $image->setImageFormat("png");
36    $image->drawImage($draw);
37
38    $bytes = $image->getImageBlob();
39    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
40}
41
42setStrokeDashOffset($strokeColor, $fillColor, $backgroundColor) ;
43echo "Ok";
44?>
45--EXPECTF--
46Ok