Warning, file /include/boost/gil/pixel_iterator.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_GIL_PIXEL_ITERATOR_HPP
0009 #define BOOST_GIL_PIXEL_ITERATOR_HPP
0010
0011 #include <boost/gil/concepts.hpp>
0012 #include <boost/gil/dynamic_step.hpp>
0013 #include <boost/gil/utilities.hpp>
0014 #include <boost/gil/pixel.hpp>
0015
0016 #include <iterator>
0017 #include <type_traits>
0018
0019 namespace boost { namespace gil {
0020
0021
0022 template <typename Iterator>
0023 class memory_based_step_iterator;
0024
0025
0026
0027 template <typename It>
0028 struct is_iterator_adaptor : public std::false_type {};
0029
0030
0031 template <typename It>
0032 struct iterator_adaptor_get_base;
0033
0034
0035 template <typename It, typename NewBaseIt>
0036 struct iterator_adaptor_rebind;
0037
0038
0039 template <typename It>
0040 struct const_iterator_type;
0041
0042
0043 template <typename T> struct const_iterator_type<T*> { using type = T const*; };
0044 template <typename T> struct const_iterator_type<T const*> { using type = T const*; };
0045
0046
0047
0048 template <typename It>
0049 struct iterator_is_mutable{};
0050
0051
0052 template <typename T>
0053 struct iterator_is_mutable<T*> : std::true_type {};
0054
0055 template <typename T>
0056 struct iterator_is_mutable<T const*> : std::false_type {};
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070 template <typename Pixel>
0071 struct dynamic_x_step_type<Pixel*> {
0072 using type = memory_based_step_iterator<Pixel *>;
0073 };
0074
0075
0076 template <typename Pixel>
0077 struct dynamic_x_step_type<const Pixel*> {
0078 using type = memory_based_step_iterator<const Pixel *>;
0079 };
0080
0081
0082
0083
0084
0085
0086 template <typename Pixel>
0087 struct color_space_type<Pixel*> : color_space_type<Pixel> {};
0088
0089 template <typename Pixel>
0090 struct color_space_type<Pixel const*> : color_space_type<Pixel> {};
0091
0092 template <typename Pixel>
0093 struct channel_mapping_type<Pixel*> : channel_mapping_type<Pixel> {};
0094
0095 template <typename Pixel>
0096 struct channel_mapping_type<Pixel const*> : channel_mapping_type<Pixel> {};
0097
0098 template <typename Pixel>
0099 struct is_planar<Pixel*> : is_planar<Pixel> {};
0100
0101 template <typename Pixel>
0102 struct is_planar<Pixel const*> : is_planar<Pixel> {};
0103
0104
0105
0106
0107
0108 template <typename Pixel>
0109 struct channel_type<Pixel*> : channel_type<Pixel> {};
0110
0111 template <typename Pixel>
0112 struct channel_type<Pixel const*> : channel_type<Pixel> {};
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 template <typename T>
0124 struct byte_to_memunit : std::integral_constant<int, 1> {};
0125
0126 template <typename P>
0127 inline std::ptrdiff_t memunit_step(P const*) { return sizeof(P); }
0128
0129 template <typename P>
0130 inline std::ptrdiff_t memunit_distance(P const* p1, P const* p2)
0131 {
0132 return (
0133 gil_reinterpret_cast_c<unsigned char const*>(p2) -
0134 gil_reinterpret_cast_c<unsigned char const*>(p1));
0135 }
0136
0137 template <typename P>
0138 inline void memunit_advance(P* &p, std::ptrdiff_t diff)
0139 {
0140 p = (P*)((unsigned char*)(p)+diff);
0141 }
0142
0143 template <typename P>
0144 inline P* memunit_advanced(const P* p, std::ptrdiff_t diff)
0145 {
0146 return (P*)((char*)(p)+diff);
0147 }
0148
0149
0150
0151
0152 template <typename P>
0153 inline P& memunit_advanced_ref(P* p, std::ptrdiff_t diff) {
0154 return *memunit_advanced(p,diff);
0155 }
0156
0157 } }
0158
0159 #endif