1--TEST--
2Test ImagickPixelIterator, clear
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11
12function clear() {
13    $imagick = new \Imagick();
14    $imagick->newPseudoImage(640, 480, "magick:logo");
15
16    $imageIterator = $imagick->getPixelRegionIterator(100, 100, 250, 200);
17
18    /* Loop trough pixel rows */
19    foreach ($imageIterator as $pixels) {
20        /** @var $pixel \ImagickPixel */
21        /* Loop through the pixels in the row (columns) */
22        foreach ($pixels as $column => $pixel) {
23            if ($column % 2) {
24                /* Paint every second pixel black*/
25                $pixel->setColor("rgba(0, 0, 0, 0)");
26            }
27        }
28        /* Sync the iterator, this is important to do on each iteration */
29        $imageIterator->syncIterator();
30    }
31
32    $imageIterator->clear();
33
34    $bytes = $imagick;
35    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
36}
37
38clear() ;
39echo "Ok";
40?>
41--EXPECTF--
42Ok