1--TEST--
2Test ImagickDraw, setClipPath
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 setClipPath($strokeColor, $fillColor, $backgroundColor) {
13
14    $draw = new \ImagickDraw();
15    $draw->setStrokeColor($strokeColor);
16    $draw->setFillColor($fillColor);
17    $draw->setStrokeOpacity(1);
18    $draw->setStrokeWidth(2);
19
20    $clipPathName = 'testClipPath';
21
22    $draw->pushClipPath($clipPathName);
23    $draw->rectangle(0, 0, 250, 250);
24    $draw->popClipPath();
25    $draw->setClipPath($clipPathName);
26    $draw->rectangle(100, 100, 400, 400);
27
28    $imagick = new \Imagick();
29    $imagick->newImage(500, 500, $backgroundColor);
30    $imagick->setImageFormat("png");
31
32    $imagick->drawImage($draw);
33
34    $bytes = $imagick->getImageBlob();
35    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
36}
37
38setClipPath($strokeColor, $fillColor, $backgroundColor) ;
39echo "Ok";
40?>
41--EXPECTF--
42Ok