Adobe Systems, Inc.

pixel_2d_locator< S_IT > Class Template Reference
[Pixel Iterators]

Support for 2D random access of the pixels of an image. More...

#include <locator.hpp>

List of all members.


Public Types

typedef std::ptrdiff_t cached_location_t
typedef pixel_iterator_traits<
X_IT >::channel_t 
channel_t
typedef pixel_iterator_traits<
X_IT >::color_space_t 
color_space_t
typedef pixel_2d_locator<
typename pixel_iterator_traits<
S_IT >::const_t
const_t
typedef std::iterator_traits<
X_IT >::difference_type 
coord_t
typedef point2< coord_tdifference_type
typedef value_type domain_t
typedef pixel_2d_locator<
typename pixel_iterator_traits<
S_IT >::dynamic_step_base_t > 
dynamic_step_t
typedef value_type pixel_t
typedef difference_type point_t
typedef std::iterator_traits<
X_IT >::reference 
reference
typedef std::iterator_traits<
X_IT >::value_type 
value_type
typedef point_t::template
axis< 0 >::coord_t 
x_coord_t
typedef X_IT x_iterator
typedef point_t::template
axis< 1 >::coord_t 
y_coord_t
typedef S_IT y_iterator

Public Member Functions

template<std::size_t D>
axis< D >::iterator axis_iterator (const point_t &p) const
template<std::size_t D>
axis< D >::iterator const & axis_iterator () const
template<std::size_t D>
axis< D >::iterator & axis_iterator ()
 BOOST_STATIC_CONSTANT (int, num_channels=color_space_t::num_channels)
cached_location_t cache_location (x_coord_t dx, y_coord_t dy) const
cached_location_t cache_location (const difference_type &d) const
reference operator * () const
bool operator!= (const pixel_2d_locator &p) const
reference operator() (x_coord_t dx, y_coord_t dy) const
pixel_2d_locator operator+ (const difference_type &d) const
pixel_2d_locatoroperator+= (const difference_type &d)
pixel_2d_locator operator- (const difference_type &d) const
pixel_2d_locatoroperator-= (const difference_type &d)
bool operator== (const pixel_2d_locator &p) const
reference operator[] (const cached_location_t &loc) const
reference operator[] (const difference_type &d) const
std::ptrdiff_t pix_bytestep () const
 pixel_2d_locator (const pixel_2d_locator &pl)
template<typename X>
 pixel_2d_locator (const pixel_2d_locator< X > &pl)
 pixel_2d_locator (x_iterator x_it, std::ptrdiff_t row_bytes)
 pixel_2d_locator ()
std::ptrdiff_t row_bytes () const
x_iterator const & x () const
x_iteratorx ()
x_iterator x_at (const difference_type &d) const
x_iterator x_at (x_coord_t dx, y_coord_t dy) const
pixel_2d_locator xy_at (x_coord_t dx, y_coord_t dy) const
pixel_2d_locator xy_at (const difference_type &d) const
y_iterator const & y () const
y_iteratory ()
y_iterator y_at (const difference_type &d) const
y_iterator y_at (x_coord_t dx, y_coord_t dy) const

Static Public Attributes

static const std::size_t num_dimensions

Friends

class pixel_2d_locator

Classes

struct  axis

Detailed Description

template<typename S_IT>
class pixel_2d_locator< S_IT >

Models: PixelLocatorConcept

The class takes a step iterator as a parameter. The step iterator provides navigation along the vertical axis while its base iterator provides horizontal navigation.

This class has a two dimensional difference type, so it supports the random access operations like:



/// 

In addition, each coordinate acts as a random-access iterator that can be modified separately: "++locator.x()" or "locator.y()+=10".

Called locator because it doesn't implement the complete interface of a random access iterator. For example, increment and decrement operations don't make sense (no way to specify dimension). Also 2D difference between two locators cannot be computed without knowledge of the X position within the image.

Each instantiation is optimal in terms of size and efficiency. For example, xy locator over interleaved rgb image results in a step iterator consisting of one std::ptrdiff_t for the row size and one native pointer (8 bytes total). ++locator.x() resolves to pointer increment.

At the other extreme, a 2D navigation of the even pixels of a planar CMYK image results in a step iterator consisting of one std::ptrdiff_t for the doubled row size, and one step iterator consisting of one std::ptrdiff_t for the horizontal step of two and a CMYK planar_ptr consisting of 4 pointers (24 bytes). In this case ++locator.x() results in four native pointer additions.

Definition at line 80 of file locator.hpp.

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