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