File: 042_Imagick_clutImage_basic.phpt

package info (click to toggle)
php-imagick 3.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,288 kB
  • sloc: ansic: 17,876; php: 1,440; xml: 444; pascal: 80; sh: 19; makefile: 2
file content (60 lines) | stat: -rw-r--r-- 1,286 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--TEST--
Test Imagick, clutImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc'); 
?>
--FILE--
<?php

$draw = new \ImagickDraw();
$draw->setStrokeOpacity(0);
$draw->setFillColor('black');
$points = [
	['x' => 40 * 3, 'y' => 10 * 5],
	['x' => 20 * 3, 'y' => 20 * 5],
	['x' => 70 * 3, 'y' => 50 * 5],
	['x' => 80 * 3, 'y' => 15 * 5],
];
$draw->polygon($points);
$imagick = new \Imagick();

$imagick->setColorspace(\Imagick::COLORSPACE_GRAY);

$imagick->newPseudoImage(
	300, 300,
	"xc:white"
);

$imagick->drawImage($draw);
$imagick->blurImage(0, 10);

$draw = new \ImagickDraw();
$draw->setStrokeOpacity(1);
$draw->setFillColor('red');
$draw->point(0, 2);
$draw->setFillColor('yellow');
$draw->rectangle(0, 0, 1, 1);
$gradient = new Imagick();
$gradient->newPseudoImage(1, 5, 'xc:black');
$gradient->drawImage($draw);
$gradient->setImageFormat('png');



$imagick->setImageFormat('png');

// This test is for IM < 7 so setInterpolate not available
// Which probably means the clutImage method isn't usuable...
//$imagick->setInterpolateMethod(Imagick::INTERPOLATE_BILINEAR);
$imagick->clutImage($gradient);

$bytes = $imagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}


echo "Ok";
?>
--EXPECTF--
Ok