1--TEST--
2Test Imagick, medianFilterImage
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__) . '/skipif.inc');
6checkClassMethods('Imagick', array('getImageMask', 'setImageMask'));
7?>
8--FILE--
9<?php
10
11$canvas = new Imagick(__DIR__ . '/houghline_input_image.png');
12
13$mask = new Imagick();
14$mask->newPseudoImage(
15	$canvas->getImageWidth(),
16	$canvas->getImageHeight(),
17	'xc:black'
18);
19
20$drawing = new ImagickDraw();
21$drawing->setBorderColor('black');
22$drawing->setFillColor('black');
23$drawing->rectangle(0, 0, $mask->getImageWidth(), $mask->getImageHeight());
24
25$drawing->setBorderColor('white');
26$drawing->setFillColor('white');
27$drawing->circle(
28	$mask->getImageWidth() / 2,
29	$mask->getImageHeight() / 2,
30	2 * $mask->getImageWidth() / 3,
31	$mask->getImageHeight() / 2
32);
33
34$mask->drawImage($drawing);
35//$mask->writeImage(__DIR__ . "/test_mask.png");
36
37// This would probably be more useful for users
38// but shows the issue with PIXELMASK_COMPOSITE
39// $mask->blurImage(10, 2);
40
41$mask_types = array(
42	\Imagick::PIXELMASK_READ =>        "PIXELMASK_READ",
43	\Imagick::PIXELMASK_WRITE =>       "PIXELMASK_WRITE",
44	\Imagick::PIXELMASK_COMPOSITE =>   "PIXELMASK_COMPOSITE",
45);
46
47$channel_types = array(
48	\Imagick::CHANNEL_ALL => "CHANNEL_ALL",
49	\Imagick::CHANNEL_RED => "CHANNEL_RED",
50	\Imagick::CHANNEL_ALPHA => "CHANNEL_ALPHA",
51	\Imagick::CHANNEL_RGBA => "CHANNEL_RGBA",
52	\Imagick::CHANNEL_BLACK => "CHANNEL_BLACK",
53	\Imagick::CHANNEL_DEFAULT => "CHANNEL_DEFAULT",
54);
55
56foreach ($channel_types as $channel_type => $channel_name) {
57	foreach ($mask_types as $type => $type_name) {
58		$output = clone $canvas;
59		$output->setImageMask($mask, $type);
60
61		$output->blurImage(15, 4, $channel_type);
62//		$output->writeImage(__DIR__ . "/test_canvas" . $type_name . "_" . $channel_name .  ".png");
63	}
64}
65
66echo "Ok";
67?>
68--EXPECTF--
69Ok