core/algorithm.hpp File Reference


Detailed Description

Some basic STL-style algorithms when applied to image views.

Author:
Lubomir Bourdev and Hailin Jin
Adobe Systems Incorporated
Date:
2005-2006
Last updated on September 24, 2006

#include <cassert>
#include <cstddef>
#include <algorithm>
#include "gil_config.hpp"
#include "gil_concept.hpp"
#include "pixel_algorithm.hpp"
#include "image_view.hpp"
#include "image_view_factory.hpp"

Go to the source code of this file.


Namespaces

namespace  std
namespace  detail

Classes

struct  binary_operation_obj
 A generic binary operation on views

Use this class as a convenience superclass when defining an operation for any image 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. More...

struct  copier_n
struct  copier_n< GIL::pixel_image_iterator< IL >, O >
struct  copier_n< I, GIL::pixel_image_iterator< OL > >
struct  copier_n< GIL::pixel_image_iterator< IL >, GIL::pixel_image_iterator< OL > >
struct  equal_n_fn
struct  equal_n_fn< const pixel< T, Cs > *, const pixel< T, Cs > * >
 Equal when both ranges are interleaved and of the same type. GIL pixels are bitwise comparable, so memcmp is used. User-defined pixels that are not bitwise comparable need to provide an overload. More...
struct  equal_n_fn< planar_ptr< IC, Cs >, planar_ptr< IC, Cs > >
 Equal when both ranges are planar pointers of the same type. memcmp is invoked for each channel plane User-defined channels that are not bitwise comparable need to provide an overload. More...
struct  equal_n_fn< GIL::pixel_image_iterator< Loc >, I2 >
struct  equal_n_fn< I1, GIL::pixel_image_iterator< Loc > >
struct  equal_n_fn< GIL::pixel_image_iterator< Loc1 >, GIL::pixel_image_iterator< Loc2 > >

Functions

template<typename T, typename Cs>
GIL_FORCEINLINE GIL::pixel<
T, Cs > * 
std::copy (GIL::pixel< T, Cs > *first, GIL::pixel< T, Cs > *last, GIL::pixel< T, Cs > *dst)
 Copy when both src and dst are interleaved and of the same type can be just memmove.
template<typename T, typename Cs>
GIL_FORCEINLINE GIL::pixel<
T, Cs > * 
std::copy (const GIL::pixel< T, Cs > *first, const GIL::pixel< T, Cs > *last, GIL::pixel< T, Cs > *dst)
 Copy when both src and dst are interleaved and of the same type can be just memmove.
template<typename IC1, typename Cs1, typename IC2, typename Cs2>
GIL_FORCEINLINE GIL::planar_ptr<
IC2, Cs2 > 
std::copy (GIL::planar_ptr< IC1, Cs1 > first, GIL::planar_ptr< IC1, Cs1 > last, GIL::planar_ptr< IC2, Cs2 > dst)
 Copy when both src and dst are planar pointers is copy for each channel.
template<typename IL, typename OL>
GIL_FORCEINLINE GIL::pixel_image_iterator<
OL > 
std::copy (GIL::pixel_image_iterator< IL > first, GIL::pixel_image_iterator< IL > last, GIL::pixel_image_iterator< OL > dst)
 std::copy(I1,I1,I2) with I1 and I2 being a pixel_image_iterator

Invoked when one calls std::copy(I1,I1,I2) with I1 and I2 being a pixel_image_iterator (which is a 1D iterator over the pixels in an image). Attempts to demote the source and destination iterators to simpler/faster types if the corresponding range is contiguous. For contiguous images (i.e. images that have no alignment gap at the end of each row) it is more efficient to use the underlying pixel iterator that does not check for the end of rows. If the underlying pixel iterator happens to be a fundamental planar/interleaved pointer, the call may further resolve to memmove. Otherwise it resolves to copying each row using the underlying pixel iterator

template<typename V1, typename V2>
ADOBE_GIL_NAMESPACE_BEGIN
GIL_FORCEINLINE void 
copy_pixels (const V1 &src, const V2 &dst)
 std::copy for image views
template<typename V1, typename V2, typename CC>
GIL_FORCEINLINE void copy_and_convert_pixels (const V1 &src, const V2 &dst, CC cc)
 Copies src view into dst view, color converting if necessary.
template<typename V1, typename V2>
GIL_FORCEINLINE void copy_and_convert_pixels (const V1 &src, const V2 &dst)
template<typename IL, typename V>
void std::fill (GIL::pixel_image_iterator< IL > first, GIL::pixel_image_iterator< IL > last, const V &val)
 std::fill(I,I,V) with I being a pixel_image_iterator

Invoked when one calls std::fill(I,I,V) with I being a pixel_image_iterator (which is a 1D iterator over the pixels in an image). For contiguous images (i.e. images that have no alignment gap at the end of each row) it is more efficient to use the underlying pixel iterator that does not check for the end of rows. For non-contiguous images fill resolves to fill of each row using the underlying pixel iterator, which is still faster

template<typename V, typename Value>
ADOBE_GIL_NAMESPACE_BEGIN
GIL_FORCEINLINE void 
fill_pixels (const V &img_view, const Value &val)
 std::fill for image views
template<typename V, typename F>
ADOBE_GIL_NAMESPACE_BEGIN F for_each_pixel (const V &img, F fun)
 std::for_each for image views
template<typename View, typename F>
for_each_pixel_position (const View &img, F fun)
 like for_each_pixel, but passes to the function object pixel locators instead of pixel references
template<typename V, typename F>
ADOBE_GIL_NAMESPACE_END ADOBE_GIL_NAMESPACE_BEGIN
generate_pixels (const V &img, F fun)
 std::generate for image views
template<typename I1, typename I2>
ADOBE_GIL_NAMESPACE_BEGIN
GIL_FORCEINLINE bool 
equal_n (I1 i1, std::ptrdiff_t n, I2 i2)
template<typename Loc1, typename Loc2>
GIL_FORCEINLINE bool std::equal (GIL::pixel_image_iterator< Loc1 > first, GIL::pixel_image_iterator< Loc1 > last, GIL::pixel_image_iterator< Loc2 > first2)
 std::equal(I1,I1,I2) with I1 and I2 being a pixel_image_iterator

Invoked when one calls std::equal(I1,I1,I2) with I1 and I2 being a pixel_image_iterator (which is a 1D iterator over the pixels in an image). Attempts to demote the source and destination iterators to simpler/faster types if the corresponding range is contiguous. For contiguous images (i.e. images that have no alignment gap at the end of each row) it is more efficient to use the underlying pixel iterator that does not check for the end of rows. If the underlying pixel iterator happens to be a fundamental planar/interleaved pointer, the call may further resolve to memcmp. Otherwise it resolves to copying each row using the underlying pixel iterator

template<typename V1, typename V2>
GIL_FORCEINLINE bool equal_pixels (const V1 &v1, const V2 &v2)
 std::equal for image views
template<typename V1, typename V2, typename F>
ADOBE_GIL_NAMESPACE_BEGIN
GIL_FORCEINLINE F 
transform_pixels (const V1 &src, const V2 &dst, F fun)
 std::transform for image views
template<typename V1, typename V2, typename V3, typename F>
GIL_FORCEINLINE F transform_pixels (const V1 &src1, const V2 &src2, const V3 &dst, F fun)
 transform_pixels with two sources
template<typename V1, typename V2, typename F>
GIL_FORCEINLINE F transform_pixel_positions (const V1 &src, const V2 &dst, F fun)
 Like transform_pixels but passes to the function object pixel locators instead of pixel references.
template<typename V1, typename V2, typename V3, typename F>
GIL_FORCEINLINE F transform_pixel_positions (const V1 &src1, const V2 &src2, const V3 &dst, F fun)
 transform_pixel_positions with two sources

Copyright © 2006 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google