123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- #ifndef BOOST_GIL_PIXEL_ITERATOR_HPP
- #define BOOST_GIL_PIXEL_ITERATOR_HPP
- #include <boost/gil/concepts.hpp>
- #include <boost/gil/dynamic_step.hpp>
- #include <boost/gil/utilities.hpp>
- #include <boost/gil/pixel.hpp>
- #include <iterator>
- #include <type_traits>
- namespace boost { namespace gil {
- template <typename Iterator>
- class memory_based_step_iterator;
- template <typename It>
- struct is_iterator_adaptor : public std::false_type {};
- template <typename It>
- struct iterator_adaptor_get_base;
- template <typename It, typename NewBaseIt>
- struct iterator_adaptor_rebind;
- template <typename It>
- struct const_iterator_type;
- template <typename T> struct const_iterator_type<T*> { using type = T const*; };
- template <typename T> struct const_iterator_type<T const*> { using type = T const*; };
- template <typename It>
- struct iterator_is_mutable{};
- template <typename T>
- struct iterator_is_mutable<T*> : std::true_type {};
- template <typename T>
- struct iterator_is_mutable<T const*> : std::false_type {};
- template <typename Pixel>
- struct dynamic_x_step_type<Pixel*> {
- using type = memory_based_step_iterator<Pixel *>;
- };
- template <typename Pixel>
- struct dynamic_x_step_type<const Pixel*> {
- using type = memory_based_step_iterator<const Pixel *>;
- };
- template <typename Pixel>
- struct color_space_type<Pixel*> : color_space_type<Pixel> {};
- template <typename Pixel>
- struct color_space_type<Pixel const*> : color_space_type<Pixel> {};
- template <typename Pixel>
- struct channel_mapping_type<Pixel*> : channel_mapping_type<Pixel> {};
- template <typename Pixel>
- struct channel_mapping_type<Pixel const*> : channel_mapping_type<Pixel> {};
- template <typename Pixel>
- struct is_planar<Pixel*> : is_planar<Pixel> {};
- template <typename Pixel>
- struct is_planar<Pixel const*> : is_planar<Pixel> {};
- template <typename Pixel>
- struct channel_type<Pixel*> : channel_type<Pixel> {};
- template <typename Pixel>
- struct channel_type<Pixel const*> : channel_type<Pixel> {};
- template <typename T>
- struct byte_to_memunit : std::integral_constant<int, 1> {};
- template <typename P>
- inline std::ptrdiff_t memunit_step(P const*) { return sizeof(P); }
- template <typename P>
- inline std::ptrdiff_t memunit_distance(P const* p1, P const* p2)
- {
- return (
- gil_reinterpret_cast_c<unsigned char const*>(p2) -
- gil_reinterpret_cast_c<unsigned char const*>(p1));
- }
- template <typename P>
- inline void memunit_advance(P* &p, std::ptrdiff_t diff)
- {
- p = (P*)((unsigned char*)(p)+diff);
- }
- template <typename P>
- inline P* memunit_advanced(const P* p, std::ptrdiff_t diff)
- {
- return (P*)((char*)(p)+diff);
- }
- template <typename P>
- inline P& memunit_advanced_ref(P* p, std::ptrdiff_t diff) {
- return *memunit_advanced(p,diff);
- }
- } }
- #endif
|