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