1--TEST--
2Test ImagickDraw, setViewBox
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 setViewBox($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15
16    $draw->setStrokeColor($strokeColor);
17    $draw->setFillColor($fillColor);
18    $draw->setStrokeWidth(2);
19    $draw->setFontSize(72);
20
21    /*
22
23    Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on.
24
25     */
26
27    $draw->circle(250, 250, 250, 0);
28    $draw->setviewbox(0, 0, 200, 200);
29    $draw->circle(125, 250, 250, 250);
30    $draw->translate(250, 125);
31    $draw->circle(0, 0, 125, 0);
32
33
34    $imagick = new \Imagick();
35    $imagick->newImage(500, 500, $backgroundColor);
36    $imagick->setImageFormat("png");
37
38    $imagick->drawImage($draw);
39
40    $bytes = $imagick->getImageBlob();
41    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
42}
43
44setViewBox($strokeColor, $fillColor, $backgroundColor) ;
45echo "Ok";
46?>
47--EXPECTF--
48Ok