8 #ifndef BOOST_GIL_BIT_ALIGNED_PIXEL_ITERATOR_HPP 9 #define BOOST_GIL_BIT_ALIGNED_PIXEL_ITERATOR_HPP 11 #include <boost/gil/bit_aligned_pixel_reference.hpp> 12 #include <boost/gil/pixel_iterator.hpp> 14 #include <boost/config.hpp> 15 #include <boost/iterator/iterator_facade.hpp> 19 namespace boost {
namespace gil {
35 template <
typename NonAlignedPixelReference>
37 typename NonAlignedPixelReference::value_type,
38 std::random_access_iterator_tag,
39 const NonAlignedPixelReference,
40 typename NonAlignedPixelReference::bit_range_t::difference_type> {
42 using parent_t = iterator_facade<bit_aligned_pixel_iterator<NonAlignedPixelReference>,
43 typename NonAlignedPixelReference::value_type,
44 std::random_access_iterator_tag,
45 const NonAlignedPixelReference,
46 typename NonAlignedPixelReference::bit_range_t::difference_type>;
49 using bit_range_t =
typename NonAlignedPixelReference::bit_range_t;
51 using difference_type =
typename parent_t::difference_type;
52 using reference =
typename parent_t::reference;
67 reference operator->()
const {
return **
this; }
68 const bit_range_t&
bit_range()
const {
return _bit_range; }
69 bit_range_t&
bit_range() {
return _bit_range; }
71 bit_range_t _bit_range;
72 static constexpr
int bit_size = NonAlignedPixelReference::bit_size;
74 friend class boost::iterator_core_access;
75 reference dereference()
const {
return NonAlignedPixelReference(_bit_range); }
76 void increment() { ++_bit_range; }
77 void decrement() { --_bit_range; }
78 void advance(difference_type d) { _bit_range.bit_advance(d*bit_size); }
80 difference_type distance_to(
const bit_aligned_pixel_iterator& it)
const {
return _bit_range.bit_distance_to(it._bit_range) / bit_size; }
84 template <
typename NonAlignedPixelReference>
89 template <
typename NonAlignedPixelReference>
90 struct iterator_is_mutable<bit_aligned_pixel_iterator<NonAlignedPixelReference> > :
public mpl::bool_<NonAlignedPixelReference::is_mutable> {};
92 template <
typename NonAlignedPixelReference>
93 struct is_iterator_adaptor<bit_aligned_pixel_iterator<NonAlignedPixelReference> > :
public mpl::false_ {};
99 template <
typename NonAlignedPixelReference>
100 struct color_space_type<bit_aligned_pixel_iterator<NonAlignedPixelReference> > :
public color_space_type<NonAlignedPixelReference> {};
102 template <
typename NonAlignedPixelReference>
103 struct channel_mapping_type<bit_aligned_pixel_iterator<NonAlignedPixelReference> > :
public channel_mapping_type<NonAlignedPixelReference> {};
105 template <
typename NonAlignedPixelReference>
106 struct is_planar<bit_aligned_pixel_iterator<NonAlignedPixelReference> > :
public is_planar<NonAlignedPixelReference> {};
112 template <
typename NonAlignedPixelReference>
113 struct byte_to_memunit<bit_aligned_pixel_iterator<NonAlignedPixelReference> > :
public mpl::int_<8> {};
115 template <
typename NonAlignedPixelReference>
117 return NonAlignedPixelReference::bit_size;
120 template <
typename NonAlignedPixelReference>
122 return (p2.bit_range().current_byte() - p1.bit_range().current_byte())*8 + p2.bit_range().bit_offset() - p1.bit_range().bit_offset();
125 template <
typename NonAlignedPixelReference>
127 p.bit_range().bit_advance(diff);
130 template <
typename NonAlignedPixelReference>
133 memunit_advance(ret, diff);
137 template <
typename NonAlignedPixelReference>
inline 139 return *memunit_advanced(it,diff);
145 template <
typename NonAlignedPixelReference>
154 template <
typename B,
typename C,
typename L,
bool M>
160 template <
typename B,
typename C,
typename L,
bool M>
166 template <
typename B,
typename C,
typename L,
bool M,
bool IsPlanar,
bool IsStep,
bool IsMutable>
176 template <
typename NonAlignedPixelReference>
reference operator[](difference_type d) const
Definition: bit_aligned_pixel_iterator.hpp:65
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
BOOST_FORCEINLINE boost::gil::pixel< T, Cs > * copy(boost::gil::pixel< T, Cs > *first, boost::gil::pixel< T, Cs > *last, boost::gil::pixel< T, Cs > *dst)
Copy when both src and dst are interleaved and of the same type can be just memmove.
Definition: algorithm.hpp:132
An iterator over non-byte-aligned pixels. Models PixelIteratorConcept, PixelBasedConcept, MemoryBasedIteratorConcept, HasDynamicXStepTypeConcept.
Definition: bit_aligned_pixel_iterator.hpp:36
Definition: algorithm.hpp:30
Definition: algorithm.hpp:127
Definition: bit_aligned_pixel_reference.hpp:39
BOOST_FORCEINLINE bool equal(boost::gil::iterator_from_2d< Loc1 > first, boost::gil::iterator_from_2d< Loc1 > last, boost::gil::iterator_from_2d< Loc2 > first2)
std::equal(I1,I1,I2) with I1 and I2 being a iterator_from_2d
Definition: algorithm.hpp:929
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
Returns the type of a pixel iterator given the pixel type, whether it operates on planar data...
Definition: metafunctions.hpp:212
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17
MEMORY-BASED STEP ITERATOR.
Definition: algorithm.hpp:36