1--TEST--
2Test ImagickDraw, translate
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$fillModifiedColor = 'LightCoral';
12$startX = 50;
13$startY = 50;
14$endX = 400;
15$endY = 400;
16$translateX = 75;
17$translateY = 75;
18
19function translate($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor,
20                   $startX, $startY, $endX, $endY, $translateX, $translateY) {
21
22    $draw = new \ImagickDraw();
23
24    $draw->setStrokeColor($strokeColor);
25    $draw->setFillColor($fillColor);
26    $draw->rectangle($startX, $startY, $endX, $endY);
27
28    $draw->setFillColor($fillModifiedColor);
29    $draw->translate($translateX, $translateY);
30    $draw->rectangle($startX, $startY, $endX, $endY);
31
32    $image = new \Imagick();
33    $image->newImage(500, 500, $backgroundColor);
34    $image->setImageFormat("png");
35
36    $image->drawImage($draw);
37
38    $bytes = $image->getImageBlob();
39    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
40}
41
42translate($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor,
43    $startX, $startY, $endX, $endY, $translateX, $translateY);
44echo "Ok";
45?>
46--EXPECTF--
47Ok