Boost GIL


memory_based_2d_locator< StepIterator > Class Template Reference

Memory-based pixel locator. Models: PixelLocatorConcept,HasDynamicXStepTypeConcept,HasDynamicYStepTypeConcept,HasTransposedTypeConcept. More...

#include <locator.hpp>

Inheritance diagram for memory_based_2d_locator< StepIterator >:
pixel_2d_locator_base< memory_based_2d_locator< StepIterator >, iterator_adaptor_get_base< StepIterator >::type, StepIterator >

Public Types

using parent_t = pixel_2d_locator_base<memory_based_2d_locator<StepIterator>, typename iterator_adaptor_get_base<StepIterator>::type, StepIterator>
using const_t = memory_based_2d_locator<typename const_iterator_type<StepIterator>::type>
using coord_t = typename parent_t::coord_t
using x_coord_t = typename parent_t::x_coord_t
using y_coord_t = typename parent_t::y_coord_t
using x_iterator = typename parent_t::x_iterator
using y_iterator = typename parent_t::y_iterator
using difference_type = typename parent_t::difference_type
using reference = typename parent_t::reference
using cached_location_t = std::ptrdiff_t
Public Types inherited from pixel_2d_locator_base< memory_based_2d_locator< StepIterator >, iterator_adaptor_get_base< StepIterator >::type, StepIterator >
using x_iterator
using y_iterator
using value_type
using reference
using coord_t
using difference_type
using point_t
using x_coord_t
using y_coord_t
using cached_location_t

Public Member Functions

 memory_based_2d_locator (const StepIterator &yit)
template<typename SI>
 memory_based_2d_locator (const memory_based_2d_locator< SI > &loc, coord_t y_step)
template<typename SI>
 memory_based_2d_locator (const memory_based_2d_locator< SI > &loc, coord_t x_step, coord_t y_step, bool transpose=false)
 memory_based_2d_locator (x_iterator xit, std::ptrdiff_t row_bytes)
template<typename X>
 memory_based_2d_locator (const memory_based_2d_locator< X > &pl)
 memory_based_2d_locator (const memory_based_2d_locator &pl)
memory_based_2d_locatoroperator= (memory_based_2d_locator const &other)=default
bool operator== (const this_t &p) const
x_iterator const & x () const
y_iterator const & y () const
x_iterator & x ()
y_iterator & y ()
x_iterator x_at (x_coord_t dx, y_coord_t dy) const
x_iterator x_at (const difference_type &d) const
this_t xy_at (x_coord_t dx, y_coord_t dy) const
this_t xy_at (const difference_type &d) const
reference operator() (x_coord_t dx, y_coord_t dy) const
reference operator[] (const difference_type &d) const
this_toperator+= (const difference_type &d)
this_toperator-= (const difference_type &d)
cached_location_t cache_location (const difference_type &d) const
cached_location_t cache_location (x_coord_t dx, y_coord_t dy) const
reference operator[] (const cached_location_t &loc) const
std::ptrdiff_t row_size () const
std::ptrdiff_t pixel_size () const
bool is_1d_traversable (x_coord_t width) const
std::ptrdiff_t y_distance_to (this_t const &p2, x_coord_t xDiff) const
Public Member Functions inherited from pixel_2d_locator_base< memory_based_2d_locator< StepIterator >, iterator_adaptor_get_base< StepIterator >::type, StepIterator >
bool operator!= (const memory_based_2d_locator< StepIterator > &p) const
x_iterator x_at (x_coord_t dx, y_coord_t dy) const
y_iterator y_at (x_coord_t dx, y_coord_t dy) const
memory_based_2d_locator< StepIterator > xy_at (x_coord_t dx, y_coord_t dy) const
axis< D >::iterator & axis_iterator ()
reference operator() (x_coord_t dx, y_coord_t dy) const
reference operator[] (const difference_type &d) const
reference operator* () const
memory_based_2d_locator< StepIterator > & operator+= (const difference_type &d)
memory_based_2d_locator< StepIterator > & operator-= (const difference_type &d)
memory_based_2d_locator< StepIterator > operator+ (const difference_type &d) const
memory_based_2d_locator< StepIterator > operator- (const difference_type &d) const
cached_location_t cache_location (const difference_type &d) const

Additional Inherited Members

Static Public Attributes inherited from pixel_2d_locator_base< memory_based_2d_locator< StepIterator >, iterator_adaptor_get_base< StepIterator >::type, StepIterator >
static const std::size_t num_dimensions

Detailed Description

template<typename StepIterator>
class boost::gil::memory_based_2d_locator< StepIterator >

Memory-based pixel locator. Models: PixelLocatorConcept,HasDynamicXStepTypeConcept,HasDynamicYStepTypeConcept,HasTransposedTypeConcept.

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.

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_pixel_iterator consisting of 4 pointers (24 bytes). In this case ++locator.x() results in four native pointer additions.

Note also that memory_based_2d_locator does not require that its element type be a pixel. It could be instantiated with an iterator whose value_type models only Regular. In this case the locator models the weaker RandomAccess2DLocatorConcept, and does not model PixelBasedConcept. Many generic algorithms don't require the elements to be pixels.


The documentation for this class was generated from the following files: