1--TEST--
2Test Tutorial, screenEmbed
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11
12function screenEmbed() {
13    $imagick = new \Imagick();
14    $imagick->newPseudoImage(640, 480, "magick:logo");
15
16    $overlay = new \Imagick();
17    $overlay->newPseudoImage(640, 480, "magick:logo");
18
19    $overlay->setImageVirtualPixelMethod(\Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
20
21    $width = $overlay->getImageWidth();
22    $height = $overlay->getImageHeight();
23
24    $offset = 332.9;
25
26    $points = array(
27        0, 0, 364 - $offset, 51,
28        $width, 0, 473.4 - $offset, 23,
29        0, $height, 433.5 - $offset, 182,
30        $width, $height, 523 - $offset, 119.4
31    );
32
33    $overlay->modulateImage(97, 100, 0);
34    $overlay->distortImage(\Imagick::DISTORTION_PERSPECTIVE, $points, true);
35
36    $imagick->compositeImage($overlay, \Imagick::COMPOSITE_OVER, (int)(364.5 - $offset), 23);
37
38    $bytes = $imagick->getImageBlob();
39    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
40}
41
42screenEmbed() ;
43echo "Ok";
44?>
45--EXPECTF--
46Ok