diff --git a/reference/imagick/imagick/getpixelregioniterator.xml b/reference/imagick/imagick/getpixelregioniterator.xml index 5d37eddd2f..8197df564d 100644 --- a/reference/imagick/imagick/getpixelregioniterator.xml +++ b/reference/imagick/imagick/getpixelregioniterator.xml @@ -5,7 +5,7 @@ Imagick::getPixelRegionIterator Get an ImagickPixelIterator for an image section - + &reftitle.description; @@ -19,7 +19,7 @@ Get an ImagickPixelIterator for an image section. - + &reftitle.parameters; @@ -28,7 +28,7 @@ x - The x-coordinate of the region. + The x-coordinate of the region. @@ -36,7 +36,7 @@ y - The y-coordinate of the region. + The y-coordinate of the region. @@ -44,7 +44,7 @@ columns - The width of the region. + The width of the region. @@ -52,28 +52,62 @@ rows - The height of the region. + The height of the region. - + &reftitle.returnvalues; Returns an ImagickPixelIterator for an image section. - + &reftitle.errors; &imagick.imagick.throws; + + + + + &reftitle.examples; + + + <function>Imagick::getPixelRegionIterator</function> example + + Iterate over the pixels in the top left of the image, changing every other one to be transparent black. + + +getPixelRegionIterator(0, 0, 10, 10); +foreach ($areaIterator as $rowIterator) { + foreach ($rowIterator as $pixel) { + if ($column % 2) { + // Paint every second pixel black + $pixel->setColor("rgba(0, 0, 0, 0)"); + } + } + $areaIterator->syncIterator(); +} +$im->writeImage("./output.png"); +?> +]]> + + + + + +