1--TEST--
2Test Imagick, distortImage
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11$distortion = 1;
12
13        //The control points move points in the image in a taffy like motion
14        $imagick = new \Imagick();
15    $imagick->newPseudoImage(640, 480, "magick:logo");
16
17        $points = array(
18
19            //Setup some control points that don't move
20            5 * $imagick->getImageWidth() / 100, 5 * $imagick->getImageHeight() / 100,
21            5 * $imagick->getImageWidth() / 100, 5 * $imagick->getImageHeight() / 100,
22
23            5 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100,
24            5 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100,
25
26            95 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100,
27            95 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100,
28
29            5 * $imagick->getImageWidth() / 100, 5 * $imagick->getImageHeight() / 100,
30            95 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100,
31//            //Move the centre of the image down and to the right
32//            50 * $imagick->getImageWidth() / 100, 50 * $imagick->getImageHeight() / 100,
33//            60 * $imagick->getImageWidth() / 100, 60 * $imagick->getImageHeight() / 100,
34//
35//            //Move a point near the top-right of the image down and to the left and down
36//            90 * $imagick->getImageWidth(), 10 * $imagick->getImageHeight(),
37//            80 * $imagick->getImageWidth(), 15 * $imagick->getImageHeight(),
38        );
39
40        $imagick->setimagebackgroundcolor("#fad888");
41        $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_EDGE);
42        $imagick->distortImage(\Imagick::DISTORTION_SHEPARDS, $points, TRUE);
43    $bytes = $imagick;
44    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
45
46echo "Ok";
47?>
48--EXPECTF--
49Ok