blob: d60b8d069b77418bfb44388043bdd65fe6f766f0 [file] [log] [blame]
<!-- Copyright 2008 Lubomir Bourdev and Hailin Jin
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<!--
Copyright 2005-2007 Adobe Systems Incorporated
Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
or a copy at http://stlab.adobe.com/licenses.html)
Some files are held under additional license.
Please see "http://stlab.adobe.com/licenses.html" for more information.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<TITLE>Generic Image Library: STL-like Algorithms</TITLE>
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/>
<LINK TYPE="text/css" REL="stylesheet" HREF="adobe_source.css"/>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" style='width: 100%; margin: 0; padding: 0'><tr>
<td width="100%" valign="top" style='padding-left: 10px; padding-right: 10px; padding-bottom: 10px'>
<div class="qindex"><a class="qindex" href="index.html">Modules</a>
| <a class="qindex" href="classes.html">Alphabetical List</a>
| <a class="qindex" href="annotated.html">Class List</a>
| <a class="qindex" href="dirs.html">Directories</a>
| <a class="qindex" href="files.html">File List</a>
| <a class="qindex" href="../index.html">GIL Home Page</a>
</div>
<!-- End Header -->
<!-- Generated by Doxygen 1.5.6 -->
<div class="contents">
<h1>STL-like Algorithms<br>
<small>
[<a class="el" href="g_i_l_0138.html">Algorithms and Utility Functions</a>]</small>
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
Image view-equivalents of STL algorithms.
<p>
Image views provide 1D iteration of their pixels via <code>begin()</code> and <code>end()</code> methods, which makes it possible to use STL algorithms with them. However, using nested loops over X and Y is in many cases more efficient. The algorithms in this section resemble STL algorithms, but they abstract away the nested loops and take views (as opposed to ranges) as input.<p>
Most algorithms check whether the <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views are 1D-traversable. A 1D-traversable <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> view has no gaps at the end of the rows. In other words, if an x_iterator of that view is advanced past the last <a class="el" href="g_i_l_0599.html" title="Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept...">pixel</a> in a row it will move to the first <a class="el" href="g_i_l_0599.html" title="Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept...">pixel</a> of the next row. When <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views are 1D-traversable, the algorithms use a single loop and run more efficiently. If one or more of the input views are not 1D-traversable, the algorithms fall-back to an X-loop nested inside a Y-loop.<p>
The algorithms typically delegate the work to their corresponding STL algorithms. For example, <code>copy_pixels</code> calls <code>std::copy</code> either for each row, or, when the images are 1D-traversable, once for all pixels.<p>
In addition, overloads are sometimes provided for the STL algorithms. For example, std::copy for planar iterators is overloaded to perform <code>std::copy</code> for each of the planes. <code>std::copy</code> over bitwise-copiable pixels results in std::copy over unsigned char, which STL typically implements via <code>memmove</code>.<p>
As a result <code>copy_pixels</code> may result in a single call to <code>memmove</code> for interleaved 1D-traversable views, or one per each plane of planar 1D-traversable views, or one per each row of interleaved non-1D-traversable images, etc.
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Modules</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0145.html">copy_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">std::copy for image views <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0144.html">copy_and_convert_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">copies src view into dst view, color converting if necessary. <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0149.html">fill_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">std::fill for image views <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0147.html">destruct_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">invokes the destructor on every <a class="el" href="g_i_l_0599.html" title="Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept...">pixel</a> of an <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> view <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0156.html">uninitialized_fill_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">std::uninitialized_fill for <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0146.html">default_construct_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">invokes the default constructor on every <a class="el" href="g_i_l_0599.html" title="Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept...">pixel</a> of an <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> view <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0155.html">uninitialized_copy_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">std::uninitialized_copy for <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0150.html">for_each_pixel</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">std::for_each for <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0151.html">for_each_pixel_position</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">adobe::for_each_position for <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views (passes locators, instead of <a class="el" href="g_i_l_0599.html" title="Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept...">pixel</a> references, to the function object) <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0152.html">generate_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">std::generate for <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0148.html">equal_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">std::equal for <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0154.html">transform_pixels</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">std::transform for <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views <br></td></tr>
<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0153.html">transform_pixel_positions</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">adobe::transform_positions for <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views (passes locators, instead of <a class="el" href="g_i_l_0599.html" title="Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept...">pixel</a> references, to the function object) <br></td></tr>
<p>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="g_i_l_0387.html">binary_operation_obj</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A generic binary operation on views<p>
Use this class as a convenience superclass when defining an operation for any <a class="el" href="g_i_l_0038.html" title="container interface over image view. Models ImageConcept, PixelBasedConcept">image</a> views. Many operations have different behavior when the two views are compatible. This class checks for compatibility and invokes apply_compatible(V1,V2) or apply_incompatible(V1,V2) of the subclass. You must provide apply_compatible(V1,V2) method in your subclass, but apply_incompatible(V1,V2) is not required and the default throws std::bad_cast. <a href="g_i_l_0387.html#_details">More...</a><br></td></tr>
</table>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sat May 2 13:50:16 2009 for Generic Image Library by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>