base class for models of PixelLocatorConcept More...
#include <locator.hpp>
Public Types | |
using | x_iterator = XIterator |
using | y_iterator = YIterator |
using | value_type = typename std::iterator_traits< x_iterator >::value_type |
using | reference = typename std::iterator_traits< x_iterator >::reference |
using | coord_t = typename std::iterator_traits< x_iterator >::difference_type |
using | difference_type = point< coord_t > |
using | point_t = difference_type |
using | x_coord_t = typename point_t::template axis< 0 >::coord_t |
using | y_coord_t = typename point_t::template axis< 1 >::coord_t |
using | cached_location_t = difference_type |
Public Member Functions | |
bool | operator!= (const Loc &p) const |
x_iterator | x_at (x_coord_t dx, y_coord_t dy) const |
x_iterator | x_at (const difference_type &d) const |
y_iterator | y_at (x_coord_t dx, y_coord_t dy) const |
y_iterator | y_at (const difference_type &d) const |
Loc | xy_at (x_coord_t dx, y_coord_t dy) const |
Loc | xy_at (const difference_type &d) const |
template<std::size_t D> | |
axis< D >::iterator & | axis_iterator () |
template<std::size_t D> | |
axis< D >::iterator const & | axis_iterator () const |
template<std::size_t D> | |
axis< D >::iterator | axis_iterator (point_t const &p) const |
reference | operator() (x_coord_t dx, y_coord_t dy) const |
reference | operator[] (const difference_type &d) const |
reference | operator* () const |
Loc & | operator+= (const difference_type &d) |
Loc & | operator-= (const difference_type &d) |
Loc | operator+ (const difference_type &d) const |
Loc | operator- (const difference_type &d) const |
cached_location_t | cache_location (const difference_type &d) const |
cached_location_t | cache_location (x_coord_t dx, y_coord_t dy) const |
Static Public Attributes | |
static const std::size_t | num_dimensions =2 |
Friends | |
template<typename X > | |
class | pixel_2d_locator |
base class for models of PixelLocatorConcept
Pixel locator is similar to a pixel iterator, but allows for 2D navigation of pixels within an image view. It has a 2D difference_type and supports 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" thereby moving the locator horizontally or vertically.
It is called a 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.
This base class provides most of the methods and type aliases needed to create a model of a locator. GIL provides two locator models as subclasses of pixel_2d_locator_base
. A memory-based locator, memory_based_2d_locator
and a virtual locator, virtual_2d_locator
. The minimum functionality a subclass must provide is this:
Models may choose to override some of the functions in the base class with more efficient versions.