mirror of
https://github.com/php/doc-ru.git
synced 2026-03-24 07:42:22 +01:00
107 lines
3.5 KiB
XML
107 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: fa0c88f1e36a3f28b4fcee0b2d1e188b54e0c44b Maintainer: alien Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="imagickpixeliterator.resetiterator">
|
||
<refnamediv>
|
||
<refname>ImagickPixelIterator::resetIterator</refname>
|
||
<refpurpose>Сбрасывает итератор пикселей</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<methodsynopsis>
|
||
<modifier>public</modifier> <type>bool</type><methodname>ImagickPixelIterator::resetIterator</methodname>
|
||
<void/>
|
||
</methodsynopsis>
|
||
&warn.undocumented.func;
|
||
<para>
|
||
Сбрасывает итератор пикселей. Используйте совместно с
|
||
ImagickPixelIterator::getNextIteratorRow() для перебора всех пикселей
|
||
в контейнере пикселей.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
&imagick.return.success;
|
||
</para>
|
||
</refsect1>
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Пример использования <function>ImagickPixelIterator::resetIterator</function></title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
function resetIterator($imagePath) {
|
||
|
||
$imagick = new \Imagick(realpath($imagePath));
|
||
|
||
$imageIterator = $imagick->getPixelIterator();
|
||
|
||
/* Походим по строкам пикселей */
|
||
foreach ($imageIterator as $pixels) {
|
||
/* Походим по пикселям в строке (столбцы) */
|
||
foreach ($pixels as $column => $pixel) {
|
||
/** @var $pixel \ImagickPixel */
|
||
if ($column % 2) {
|
||
|
||
/* Делаем каждый второй пиксель на 25% красным*/
|
||
$pixel->setColorValue(\Imagick::COLOR_RED, 64);
|
||
}
|
||
}
|
||
/* Синхронизируем итератор. Это необходимо для делать на каждой итерации */
|
||
$imageIterator->syncIterator();
|
||
}
|
||
|
||
$imageIterator->resetiterator();
|
||
|
||
/* Походим по строкам пикселей */
|
||
foreach ($imageIterator as $pixels) {
|
||
/* Походим по пикселям в строке (столбцы) */
|
||
foreach ($pixels as $column => $pixel) {
|
||
/** @var $pixel \ImagickPixel */
|
||
if ($column % 3) {
|
||
$pixel->setColorValue(\Imagick::COLOR_BLUE, 64); /* Делаем каждый второй пиксель немного синим*/
|
||
//$pixel->setColor("rgba(0, 0, 128, 0)"); /* Paint every second pixel black*/
|
||
}
|
||
}
|
||
$imageIterator->syncIterator(); /* Синхронизируем итератор. Это необходимо для делать на каждой итерации */
|
||
}
|
||
|
||
$imageIterator->clear();
|
||
|
||
header("Content-Type: image/jpg");
|
||
echo $imagick;
|
||
}
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
</refentry>
|
||
<!-- Keep this comment at the end of the file
|
||
Local variables:
|
||
mode: sgml
|
||
sgml-omittag:t
|
||
sgml-shorttag:t
|
||
sgml-minimize-attributes:nil
|
||
sgml-always-quote-attributes:t
|
||
sgml-indent-step:1
|
||
sgml-indent-data:t
|
||
indent-tabs-mode:nil
|
||
sgml-parent-document:nil
|
||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||
sgml-exposed-tags:nil
|
||
sgml-local-catalogs:nil
|
||
sgml-local-ecat-files:nil
|
||
End:
|
||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
vim: et tw=78 syn=sgml
|
||
vi: ts=1 sw=1
|
||
-->
|