<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Changes the color value of any pixel that matches target</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.flipimage.html">Imagick::flipImage</a></div> <div class="next" style="text-align: right; float: right;"><a href="imagick.flopimage.html">Imagick::flopImage</a></div> <div class="up"><a href="class.imagick.html">Imagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="imagick.floodfillpaintimage" class="refentry"> <div class="refnamediv"> <h1 class="refname">Imagick::floodFillPaintImage</h1> <p class="verinfo">(No version information available, might only be in SVN)</p><p class="refpurpose"><span class="refname">Imagick::floodFillPaintImage</span> — <span class="dc-title">Changes the color value of any pixel that matches target</span></p> </div> <div class="refsect1 description" id="refsect1-imagick.floodfillpaintimage-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>Imagick::floodFillPaintImage</strong></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$fill</code></span> , <span class="methodparam"><span class="type">float</span> <code class="parameter">$fuzz</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$target</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$x</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$y</code></span> , <span class="methodparam"><span class="type">bool</span> <code class="parameter">$invert</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$channel</code><span class="initializer"> = Imagick::CHANNEL_DEFAULT</span></span> ] )</div> <p class="para rdfs-comment"> Changes the color value of any pixel that matches target and is an immediate neighbor. This method is a replacement for deprecated <span class="function"><a href="imagick.paintfloodfillimage.html" class="function">Imagick::paintFloodFillImage()</a></span>. This method is available if Imagick has been compiled against ImageMagick version 6.3.8 or newer. </p> </div> <div class="refsect1 parameters" id="refsect1-imagick.floodfillpaintimage-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">fill</code></em></span> <dd> <p class="para"> ImagickPixel object or a string containing the fill color </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">fuzz</code></em></span> <dd> <p class="para"> The amount of fuzz. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">target</code></em></span> <dd> <p class="para"> ImagickPixel object or a string containing the target color to paint </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">x</code></em></span> <dd> <p class="para"> X start position of the floodfill </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">y</code></em></span> <dd> <p class="para"> Y start position of the floodfill </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">invert</code></em></span> <dd> <p class="para"> If <strong><code>TRUE</code></strong> paints any pixel that does not match the target color. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">channel</code></em></span> <dd> <p class="para"> Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine <a href="imagick.constants.html#imagick.constants.channel" class="link">channel constants</a> using bitwise operators. Defaults to <strong><code>Imagick::CHANNEL_DEFAULT</code></strong>. Refer to this list of <a href="imagick.constants.html#imagick.constants.channel" class="link">channel constants</a> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-imagick.floodfillpaintimage-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success. </p> </div> <div class="refsect1 examples" id="refsect1-imagick.floodfillpaintimage-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3321"> <p><strong>Example #1 <span class="methodname"><strong>Imagick::floodfillPaintImage()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">/* Create new imagick object */<br /></span><span style="color: #0000BB">$im </span><span style="color: #007700">= new </span><span style="color: #0000BB">Imagick</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/* create red, green and blue images */<br /></span><span style="color: #0000BB">$im</span><span style="color: #007700">-></span><span style="color: #0000BB">newImage</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #DD0000">"red"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$im</span><span style="color: #007700">-></span><span style="color: #0000BB">newImage</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #DD0000">"green"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$im</span><span style="color: #007700">-></span><span style="color: #0000BB">newImage</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #DD0000">"blue"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Append the images into one */<br /></span><span style="color: #0000BB">$im</span><span style="color: #007700">-></span><span style="color: #0000BB">resetIterator</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$combined </span><span style="color: #007700">= </span><span style="color: #0000BB">$im</span><span style="color: #007700">-></span><span style="color: #0000BB">appendImages</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Save the intermediate image for comparison */<br /></span><span style="color: #0000BB">$combined</span><span style="color: #007700">-></span><span style="color: #0000BB">writeImage</span><span style="color: #007700">(</span><span style="color: #DD0000">"floodfillpaint_intermediate.png"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* The target pixel to paint */<br /></span><span style="color: #0000BB">$x </span><span style="color: #007700">= </span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/* Get the color we are painting */<br /></span><span style="color: #0000BB">$target </span><span style="color: #007700">= </span><span style="color: #0000BB">$combined</span><span style="color: #007700">-></span><span style="color: #0000BB">getImagePixelColor</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">, </span><span style="color: #0000BB">$y</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Paints pixel in position 1,1 black and all neighboring <br /> pixels that match the target color */<br /></span><span style="color: #0000BB">$combined</span><span style="color: #007700">-></span><span style="color: #0000BB">floodfillPaintImage</span><span style="color: #007700">(</span><span style="color: #DD0000">"black"</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">$target</span><span style="color: #007700">, </span><span style="color: #0000BB">$x</span><span style="color: #007700">, </span><span style="color: #0000BB">$y</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Save the result */<br /></span><span style="color: #0000BB">$combined</span><span style="color: #007700">-></span><span style="color: #0000BB">writeImage</span><span style="color: #007700">(</span><span style="color: #DD0000">"floodfillpaint_result.png"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="mediaobject"> <div class="imageobject"> <img src="images/c0d23d2d6769e53e24a1b3136c064577-floodfillpaint_intermediate.png" alt="Output of example : Imagick::floodfillPaintImage()" width="100" height="150" /> </div> <div class="imageobject"> <img src="images/c0d23d2d6769e53e24a1b3136c064577-floodfillpaint_result.png" alt="Output of example : Imagick::floodfillPaintImage()" width="100" height="150" /> </div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.flipimage.html">Imagick::flipImage</a></div> <div class="next" style="text-align: right; float: right;"><a href="imagick.flopimage.html">Imagick::flopImage</a></div> <div class="up"><a href="class.imagick.html">Imagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>