1--TEST--
2Test ImagickDraw, composite
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11require_once(dirname(__FILE__) . '/functions.inc');
12
13$backgroundColor = 'rgb(225, 225, 225)';
14$strokeColor = 'rgb(0, 0, 0)';
15$fillColor = 'DodgerBlue2';
16
17function composite($strokeColor, $fillColor, $backgroundColor) {
18
19    $draw = new \ImagickDraw();
20
21    setFontForImagickDraw($draw);
22
23    $draw->setStrokeColor($strokeColor);
24    $draw->setFillColor($fillColor);
25    $draw->setFillOpacity(1);
26    $draw->setStrokeWidth(2);
27    $draw->setFontSize(72);
28    $draw->setStrokeOpacity(1);
29    $draw->setStrokeColor($strokeColor);
30    $draw->setStrokeWidth(2);
31    $draw->setFontSize(140);
32    $draw->rectangle(0, 0, 1000, 300);
33    $draw->setFillColor('white');
34    $draw->setfillopacity(1);
35    $draw->annotation(50, 180, "Lorem Ipsum!");
36
37//    $imagick = new \Imagick(realpath("../images/TestImage.jpg"));
38//    $draw->composite(\Imagick::COMPOSITE_MULTIPLY, -500, -200, 2000, 600, $imagick);
39
40    //$imagick->compositeImage($draw, 0, 0, 1000, 500);
41    //$draw->composite(Imagick::COMPOSITE_COLORBURN, -500, -200, 2000, 600, $imagick);
42
43    //Create an image object which the draw commands can be rendered into
44    $imagick = new \Imagick();
45    $imagick->newImage(1000, 302, $backgroundColor);
46    $imagick->setImageFormat("png");
47
48    //Render the draw commands in the ImagickDraw object
49    //into the image.
50    $imagick->drawImage($draw);
51
52    //Send the image to the browser
53    $bytes = $imagick->getImageBlob();
54    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
55}
56
57composite($strokeColor, $fillColor, $backgroundColor) ;
58echo "Ok";
59?>
60--EXPECTF--
61Ok