mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Added example of how to use getPixelRegionIterator.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335701 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
20d255c120
commit
7f56a87bce
1 changed files with 42 additions and 8 deletions
|
@ -5,7 +5,7 @@
|
|||
<refname>Imagick::getPixelRegionIterator</refname>
|
||||
<refpurpose>Get an ImagickPixelIterator for an image section</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
|
@ -19,7 +19,7 @@
|
|||
Get an ImagickPixelIterator for an image section.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
|
@ -28,7 +28,7 @@
|
|||
<term><parameter>x</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The x-coordinate of the region.
|
||||
The x-coordinate of the region.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<term><parameter>y</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The y-coordinate of the region.
|
||||
The y-coordinate of the region.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<term><parameter>columns</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The width of the region.
|
||||
The width of the region.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -52,28 +52,62 @@
|
|||
<term><parameter>rows</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The height of the region.
|
||||
The height of the region.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns an ImagickPixelIterator for an image section.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
&imagick.imagick.throws;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
|
||||
<refsect1 role="examples"><!-- {{{ -->
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example xml:id="function-name.example.basic"><!-- {{{ -->
|
||||
<title><function>Imagick::getPixelRegionIterator</function> example</title>
|
||||
<para>
|
||||
Iterate over the pixels in the top left of the image, changing every other one to be transparent black.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$im = new Imagick(realpath("./testImage.png"));
|
||||
$areaIterator = $im->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");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
</example><!-- }}} -->
|
||||
</para>
|
||||
</refsect1><!-- }}} -->
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
Loading…
Reference in a new issue