8 #ifndef BOOST_GIL_PIXEL_ITERATOR_ADAPTOR_HPP 9 #define BOOST_GIL_PIXEL_ITERATOR_ADAPTOR_HPP 11 #include <boost/gil/concepts.hpp> 12 #include <boost/gil/pixel_iterator.hpp> 14 #include <boost/iterator/iterator_facade.hpp> 18 namespace boost {
namespace gil {
27 template <
typename Iterator,
31 typename DFn::value_type,
32 typename std::iterator_traits<Iterator>::iterator_category,
33 typename DFn::reference,
37 using parent_t = iterator_adaptor<dereference_iterator_adaptor<Iterator,DFn>,
39 typename DFn::value_type,
40 typename std::iterator_traits<Iterator>::iterator_category,
41 typename DFn::reference,
43 using reference =
typename DFn::result_type;
44 using difference_type =
typename std::iterator_traits<Iterator>::difference_type;
45 using dereference_fn = DFn;
48 template <
typename Iterator1>
51 template <
typename Iterator1,
typename DFn1>
55 reference
operator[](difference_type d)
const {
return *(*
this+d);}
66 Iterator& base() {
return this->base_reference(); }
67 const Iterator& base()
const {
return this->base_reference(); }
68 const DFn& deref_fn()
const {
return _deref_fn; }
70 template <
typename Iterator1,
typename DFn1>
72 friend class boost::iterator_core_access;
74 reference dereference()
const {
return _deref_fn(*(this->base_reference())); }
77 template <
typename I,
typename DFn>
82 template <
typename I,
typename DFn>
83 struct iterator_is_mutable<dereference_iterator_adaptor<I,DFn> > :
public mpl::bool_<DFn::is_mutable> {};
86 template <
typename I,
typename DFn>
89 template <
typename I,
typename DFn>
94 template <
typename I,
typename DFn,
typename NewBaseIterator>
103 template <
typename I,
typename DFn>
104 struct color_space_type<dereference_iterator_adaptor<I,DFn> > :
public color_space_type<typename DFn::value_type> {};
106 template <
typename I,
typename DFn>
107 struct channel_mapping_type<dereference_iterator_adaptor<I,DFn> > :
public channel_mapping_type<typename DFn::value_type> {};
109 template <
typename I,
typename DFn>
110 struct is_planar<dereference_iterator_adaptor<I,DFn> > :
public is_planar<typename DFn::value_type> {};
112 template <
typename I,
typename DFn>
120 template <
typename Iterator,
typename DFn>
123 template <
typename Iterator,
typename DFn>
124 inline typename std::iterator_traits<Iterator>::difference_type
126 return memunit_step(p.base());
129 template <
typename Iterator,
typename DFn>
130 inline typename std::iterator_traits<Iterator>::difference_type
133 return memunit_distance(p1.base(),p2.base());
136 template <
typename Iterator,
typename DFn>
138 typename std::iterator_traits<Iterator>::difference_type diff) {
139 memunit_advance(p.base(), diff);
142 template <
typename Iterator,
typename DFn>
145 typename std::iterator_traits<Iterator>::difference_type diff) {
150 template <
typename Iterator,
typename DFn>
152 typename std::iterator_traits<dereference_iterator_adaptor<Iterator,DFn> >::reference
154 typename std::iterator_traits<Iterator>::difference_type diff) {
155 return *memunit_advanced(p, diff);
162 template <
typename Iterator,
typename DFn>
169 template <
typename Iterator,
typename Deref>
175 static type make(
const Iterator& it,
const Deref& d) {
return type(it,d); }
180 template <
typename Iterator,
typename PREV_DEREF,
typename Deref>
Represents a unary function object that can be invoked upon dereferencing a pixel iterator...
Definition: pixel_dereference.hpp:52
Definition: pixel_iterator.hpp:110
metafunction predicate determining whether the given iterator is a plain one or an adaptor over anoth...
Definition: metafunctions.hpp:42
Definition: algorithm.hpp:30
Definition: algorithm.hpp:30
returns the base iterator for a given iterator adaptor. Provide an specialization when introducing ne...
Definition: metafunctions.hpp:43
Returns the type (and creates an instance) of an iterator that invokes the given dereference adaptor ...
Definition: locator.hpp:27
An adaptor over an existing iterator that provides for custom filter on dereferencing the object...
Definition: pixel_iterator_adaptor.hpp:29
Composes two dereference function objects. Similar to std::unary_compose but needs to pull some alias...
Definition: utilities.hpp:105
Definition: color_convert.hpp:30
reference operator[](difference_type d) const
Definition: pixel_iterator_adaptor.hpp:55
Changes the base iterator of an iterator adaptor. Provide an specialization when introducing new iter...
Definition: pixel_iterator.hpp:35
Metafunction predicate returning whether the given iterator allows for changing its values...
Definition: pixel_iterator.hpp:48
Returns the type of an iterator just like the input iterator, except operating over immutable values...
Definition: pixel_iterator.hpp:39
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17