1--TEST--
2Test ImagickPixelIterator, getNextIteratorRow
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11
12function getNextIteratorRow() {
13    $imagick = new \Imagick();
14    $imagick->newPseudoImage(640, 480, "magick:logo");
15    $imageIterator = $imagick->getPixelIterator();
16
17    $count = 0;
18    while ($pixels = $imageIterator->getNextIteratorRow()) {
19        if (($count % 3) == 0) {
20            /* Loop through the pixels in the row (columns) */
21            foreach ($pixels as $column => $pixel) {
22                /** @var $pixel \ImagickPixel */
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        $count += 1;
33    }
34
35    $bytes = $imagick;
36    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
37}
38
39getNextIteratorRow() ;
40echo "Ok";
41?>
42--EXPECTF--
43Ok