Boost GIL


concepts.hpp
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_CONCEPTS_HPP
9 #define BOOST_GIL_CONCEPTS_HPP
10 
11 #include <boost/config.hpp>
12 #include <boost/concept_check.hpp>
13 #include <boost/core/ignore_unused.hpp>
14 #include <boost/iterator/iterator_concepts.hpp>
15 #include <boost/mpl/and.hpp>
16 #include <boost/mpl/size.hpp>
17 #include <boost/type_traits.hpp>
18 #include <boost/utility/enable_if.hpp>
19 
20 #include <cstdint>
21 #include <iterator>
22 #include <utility>
23 
24 namespace boost { namespace gil {
25 
26 #if defined(__GNUC__) && (__GNUC__ >= 4)
27 #pragma GCC diagnostic push
28 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
29 #endif
30 
31 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
32 #pragma warning(push)
33 #pragma warning(disable:4510) //default constructor could not be generated
34 #pragma warning(disable:4512) //assignment operator could not be generated
35 #pragma warning(disable:4610) //can never be instantiated - user defined constructor required
36 #endif
37 
38 template <typename T> struct channel_traits;
39 template <typename P> struct is_pixel;
40 template <typename dstT, typename srcT>
41 typename channel_traits<dstT>::value_type channel_convert(const srcT& val);
42 template <typename T> class point;
43 template <std::size_t K, typename T> const T& axis_value(point<T> const& p);
44 template <std::size_t K, typename T> T& axis_value(point<T>& p);
45 template <typename ColorBase, int K> struct kth_element_type;
46 template <typename ColorBase, int K> struct kth_element_reference_type;
47 template <typename ColorBase, int K> struct kth_element_const_reference_type;
48 template <typename ColorBase, int K> struct kth_semantic_element_reference_type;
49 template <typename ColorBase, int K> struct kth_semantic_element_const_reference_type;
50 template <typename ColorBase> struct size;
51 template <typename ColorBase> struct element_type;
52 template <typename T> struct channel_type;
53 template <typename T> struct color_space_type;
54 template <typename T> struct channel_mapping_type;
55 template <typename T> struct is_planar;
56 template <typename T> struct num_channels;
57 
58 template <typename It> struct const_iterator_type;
59 template <typename It> struct iterator_is_mutable;
60 template <typename It> struct is_iterator_adaptor;
61 template <typename It, typename NewBaseIt> struct iterator_adaptor_rebind;
62 template <typename It> struct iterator_adaptor_get_base;
63 
64 
65 // forward-declare at_c
66 namespace detail { template <typename Element, typename Layout, int K> struct homogeneous_color_base; }
67 template <int K, typename E, typename L, int N>
68 typename add_reference<E>::type at_c( detail::homogeneous_color_base<E,L,N>& p);
69 
70 template <int K, typename E, typename L, int N>
71 typename add_reference<typename add_const<E>::type>::type at_c(const detail::homogeneous_color_base<E,L,N>& p);
72 
73 template <typename P, typename C, typename L> struct packed_pixel;
74 template <int K, typename P, typename C, typename L>
75 typename kth_element_reference_type<packed_pixel<P,C,L>, K>::type
77 
78 template <int K, typename P, typename C, typename L>
79 typename kth_element_const_reference_type<packed_pixel<P,C,L>,K>::type
80 at_c(const packed_pixel<P,C,L>& p);
81 
82 template <typename B, typename C, typename L, bool M> struct bit_aligned_pixel_reference;
83 
84 template <int K, typename B, typename C, typename L, bool M> inline
85 typename kth_element_reference_type<bit_aligned_pixel_reference<B,C,L,M>, K>::type
87 
88 // Forward-declare semantic_at_c
89 template <int K, typename ColorBase>
90 typename disable_if<is_const<ColorBase>,typename kth_semantic_element_reference_type<ColorBase,K>::type>::type semantic_at_c(ColorBase& p);
91 template <int K, typename ColorBase>
92 typename kth_semantic_element_const_reference_type<ColorBase,K>::type semantic_at_c(const ColorBase& p);
93 
94 template <typename T> struct dynamic_x_step_type;
95 template <typename T> struct dynamic_y_step_type;
96 template <typename T> struct transposed_type;
97 
98 namespace detail {
99 template <typename T>
100 void initialize_it(T&) {}
101 } // namespace detail
102 
103 template <typename T>
104 struct remove_const_and_reference : public remove_const<typename remove_reference<T>::type> {};
105 
106 #ifdef BOOST_GIL_USE_CONCEPT_CHECK
107  #define GIL_CLASS_REQUIRE(type_var, ns, concept) BOOST_CLASS_REQUIRE(type_var, ns, concept);
108  template <typename C> void gil_function_requires() { function_requires<C>(); }
109 #else
110  #define GIL_CLASS_REQUIRE(T,NS,C)
111  template <typename C> void gil_function_requires() {}
112 #endif
113 
115 
122 template <typename T>
124  void constraints() {
125  function_requires<boost::DefaultConstructibleConcept<T> >();
126  }
127 };
128 
130 
137 template <typename T>
139  void constraints() {
140  function_requires<boost::CopyConstructibleConcept<T> >();
141  }
142 };
143 
145 
153 template <typename T>
154 struct Assignable {
155  void constraints() {
156  function_requires<boost::AssignableConcept<T> >();
157  }
158 };
160 
168 template <typename T>
170  void constraints() {
171  function_requires<boost::EqualityComparableConcept<T> >();
172  }
173 };
174 
176 
182 template <typename T, typename U>
183 struct SameType {
184  void constraints() {
185  BOOST_STATIC_ASSERT((boost::is_same<T,U>::value_core));
186  }
187 };
188 
190 
197 template <typename T>
198 struct Swappable {
199  void constraints() {
200  using std::swap;
201  swap(x,y);
202  }
203  T x,y;
204 };
205 
207 
214 template <typename T>
215 struct Regular {
216  void constraints() {
217  gil_function_requires< boost::DefaultConstructibleConcept<T> >();
218  gil_function_requires< boost::CopyConstructibleConcept<T> >();
219  gil_function_requires< boost::EqualityComparableConcept<T> >(); // ==, !=
220  gil_function_requires< boost::AssignableConcept<T> >();
221  gil_function_requires< Swappable<T> >();
222  }
223 };
224 
226 
233 template <typename T>
234 struct Metafunction {
235  void constraints() {
236  typedef typename T::type type;
237  }
238 };
240 //
241 // POINT CONCEPTS
242 //
244 
247 
262 template <typename P>
264  void constraints() {
265  gil_function_requires< Regular<P> >();
266 
267  typedef typename P::value_type value_type;
268  static const std::size_t N=P::num_dimensions; ignore_unused_variable_warning(N);
269  typedef typename P::template axis<0>::coord_t FT;
270  typedef typename P::template axis<N-1>::coord_t LT;
271  FT ft=gil::axis_value<0>(point);
272  axis_value<0>(point)=ft;
273  LT lt=axis_value<N-1>(point);
274  axis_value<N-1>(point)=lt;
275 
276 // value_type v=point[0]; ignore_unused_variable_warning(v);
277  }
278  P point;
279 };
280 
283 
299 template <typename P>
301  void constraints() {
302  gil_function_requires< PointNDConcept<P> >();
303  BOOST_STATIC_ASSERT(P::num_dimensions == 2);
304  point.x=point.y;
305  point[0]=point[1];
306  }
307  P point;
308 };
309 
311 //
312 // ITERATOR MUTABILITY CONCEPTS
313 //
314 // Taken from boost's concept_check.hpp. Isolating mutability to result in faster compile time
315 //
317 
318 namespace detail {
319  template <class TT> // Preconditions: TT Models boost_concepts::ForwardTraversalConcept
320  struct ForwardIteratorIsMutableConcept {
321  void constraints() {
322  *i++ = *i; // require postincrement and assignment
323  }
324  TT i;
325  };
326 
327  template <class TT> // Preconditions: TT Models boost::BidirectionalIteratorConcept
328  struct BidirectionalIteratorIsMutableConcept {
329  void constraints() {
330  gil_function_requires< ForwardIteratorIsMutableConcept<TT> >();
331  *i-- = *i; // require postdecrement and assignment
332  }
333  TT i;
334  };
335 
336  template <class TT> // Preconditions: TT Models boost_concepts::RandomAccessTraversalConcept
337  struct RandomAccessIteratorIsMutableConcept {
338  void constraints() {
339  gil_function_requires< BidirectionalIteratorIsMutableConcept<TT> >();
340  typename std::iterator_traits<TT>::difference_type n=0; ignore_unused_variable_warning(n);
341  i[n] = *i; // require element access and assignment
342  }
343  TT i;
344  };
345 } // namespace detail
346 
348 //
349 // COLOR SPACE CONCEPTS
350 //
352 
355 
362 template <typename Cs>
364  void constraints() {
365  // An MPL Random Access Sequence, whose elements are color tags
366  }
367 };
368 
369 template <typename ColorSpace1, typename ColorSpace2> // Models ColorSpaceConcept
370 struct color_spaces_are_compatible : public is_same<ColorSpace1,ColorSpace2> {};
371 
374 
381 template <typename Cs1, typename Cs2>
383  void constraints() {
384  BOOST_STATIC_ASSERT((color_spaces_are_compatible<Cs1,Cs2>::value));
385  }
386 };
387 
390 
397 template <typename CM>
399  void constraints() {
400  // An MPL Random Access Sequence, whose elements model MPLIntegralConstant representing a permutation
401  }
402 };
403 
404 
405 
411 
414 
436 template <typename T>
438  void constraints() {
439  gil_function_requires< boost::EqualityComparableConcept<T> >();
440 
441  typedef typename channel_traits<T>::value_type v;
442  typedef typename channel_traits<T>::reference r;
443  typedef typename channel_traits<T>::pointer p;
444  typedef typename channel_traits<T>::const_reference cr;
445  typedef typename channel_traits<T>::const_pointer cp;
446 
447  channel_traits<T>::min_value();
448  channel_traits<T>::max_value();
449  }
450 
451  T c;
452 };
453 
454 namespace detail {
455  // Preconditions: T models ChannelConcept
456  template <typename T>
457  struct ChannelIsMutableConcept {
458  void constraints() {
459  c1=c2;
460  using std::swap;
461  swap(c1,c2);
462  }
463  T c1;
464  T c2;
465  };
466 }
467 
470 
475 template <typename T>
477  void constraints() {
478  gil_function_requires<ChannelConcept<T> >();
479  gil_function_requires<detail::ChannelIsMutableConcept<T> >();
480  }
481 };
482 
485 
490 template <typename T>
492  void constraints() {
493  gil_function_requires<ChannelConcept<T> >();
494  gil_function_requires<Regular<T> >();
495  }
496 };
497 
498 
503 
510 template <typename T1, typename T2> // Models GIL Pixel
512  : public is_same<typename channel_traits<T1>::value_type, typename channel_traits<T2>::value_type> {};
513 
516 
523 template <typename T1, typename T2>
525  void constraints() {
526  BOOST_STATIC_ASSERT((channels_are_compatible<T1,T2>::value));
527  }
528 };
529 
534 
541 template <typename SrcChannel, typename DstChannel>
543  void constraints() {
544  gil_function_requires<ChannelConcept<SrcChannel> >();
545  gil_function_requires<MutableChannelConcept<DstChannel> >();
546  dst=channel_convert<DstChannel,SrcChannel>(src); ignore_unused_variable_warning(dst);
547  }
548  SrcChannel src;
549  DstChannel dst;
550 };
551 
552 
553 
554 
555 
561 
564 
604 template <typename ColorBase>
606  void constraints() {
607  gil_function_requires< CopyConstructible<ColorBase> >();
608  gil_function_requires< EqualityComparable<ColorBase> >();
609 
610  typedef typename ColorBase::layout_t::color_space_t color_space_t;
611  gil_function_requires<ColorSpaceConcept<color_space_t> >();
612 
613  typedef typename ColorBase::layout_t::channel_mapping_t channel_mapping_t;
614  // TODO: channel_mapping_t must be an MPL RandomAccessSequence
615 
616  static const int num_elements = size<ColorBase>::value;
617 
618  typedef typename kth_element_type<ColorBase,num_elements-1>::type TN;
619  typedef typename kth_element_const_reference_type<ColorBase,num_elements-1>::type CR;
620 
621  CR cr=gil::at_c<num_elements-1>(cb); ignore_unused_variable_warning(cr);
622 
623  // functions that work for every pixel (no need to require them)
624  semantic_at_c<0>(cb);
625  semantic_at_c<num_elements-1>(cb);
626  // also static_max(cb), static_min(cb), static_fill(cb,value), and all variations of static_for_each(), static_generate(), static_transform()
627  }
628 
629  ColorBase cb;
630 };
631 
634 
647 template <typename ColorBase>
649  void constraints() {
650  gil_function_requires< ColorBaseConcept<ColorBase> >();
651  gil_function_requires< Assignable<ColorBase> >();
652  gil_function_requires< Swappable<ColorBase> >();
653 
654  typedef typename kth_element_reference_type<ColorBase, 0>::type CR;
655 
656  CR r=gil::at_c<0>(cb);
657  gil::at_c<0>(cb)=r;
658  }
659 
660  ColorBase cb;
661 };
662 
665 
671 template <typename ColorBase>
673  void constraints() {
674  gil_function_requires< MutableColorBaseConcept<ColorBase> >();
675  gil_function_requires< Regular<ColorBase> >();
676  }
677 };
678 
681 
691 template <typename ColorBase>
693  void constraints() {
694  gil_function_requires< ColorBaseConcept<ColorBase> >();
695 
696  static const int num_elements = size<ColorBase>::value;
697 
698  typedef typename kth_element_type<ColorBase,0>::type T0;
699  typedef typename kth_element_type<ColorBase,num_elements-1>::type TN;
700 
701  BOOST_STATIC_ASSERT((is_same<T0,TN>::value)); // better than nothing
702  typedef typename kth_element_const_reference_type<ColorBase,0>::type CRef0;
703  CRef0 e0=dynamic_at_c(cb,0);
704  }
705  ColorBase cb;
706 };
707 
710 
719 template <typename ColorBase>
721  void constraints() {
722  gil_function_requires< ColorBaseConcept<ColorBase> >();
723  gil_function_requires< HomogeneousColorBaseConcept<ColorBase> >();
724  typedef typename kth_element_reference_type<ColorBase, 0>::type R0;
725  R0 x=dynamic_at_c(cb,0);
726  dynamic_at_c(cb,0) = dynamic_at_c(cb,0);
727  }
728  ColorBase cb;
729 };
730 
733 
741 template <typename ColorBase>
743  void constraints() {
744  gil_function_requires< MutableHomogeneousColorBaseConcept<ColorBase> >();
745  gil_function_requires< Regular<ColorBase> >();
746  }
747 };
748 
749 
752 
763 template <typename ColorBase1, typename ColorBase2>
765  void constraints() {
766  BOOST_STATIC_ASSERT((is_same<typename ColorBase1::layout_t::color_space_t,
767  typename ColorBase2::layout_t::color_space_t>::value));
768 // typedef typename kth_semantic_element_type<ColorBase1,0>::type e1;
769 // typedef typename kth_semantic_element_type<ColorBase2,0>::type e2;
770 // "e1 is convertible to e2"
771  }
772 };
773 
774 
775 
776 
777 
778 
779 
780 
781 
782 
783 
784 
785 
786 
787 
788 
789 
790 
791 
792 
793 
794 
800 
803 
818 template <typename P>
820  void constraints() {
821  typedef typename color_space_type<P>::type color_space_t;
822  gil_function_requires<ColorSpaceConcept<color_space_t> >();
823  typedef typename channel_mapping_type<P>::type channel_mapping_t;
824  gil_function_requires<ChannelMappingConcept<channel_mapping_t> >();
825 
826  static const bool planar = is_planar<P>::type::value; ignore_unused_variable_warning(planar);
827 
828 
829  // This is not part of the concept, but should still work
830  static const std::size_t nc = num_channels<P>::value;
831  ignore_unused_variable_warning(nc);
832  }
833 };
834 
837 
846 template <typename P>
848  void constraints() {
849  gil_function_requires<PixelBasedConcept<P> >();
850  typedef typename channel_type<P>::type channel_t;
851  gil_function_requires<ChannelConcept<channel_t> >();
852  }
853 };
854 
855 
858 
880 template <typename P>
881 struct PixelConcept {
882  void constraints() {
883  gil_function_requires<ColorBaseConcept<P> >();
884  gil_function_requires<PixelBasedConcept<P> >();
885 
886  BOOST_STATIC_ASSERT((is_pixel<P>::value));
887  static const bool is_mutable = P::is_mutable; ignore_unused_variable_warning(is_mutable);
888 
889  typedef typename P::value_type value_type;
890 // gil_function_requires<PixelValueConcept<value_type> >();
891 
892  typedef typename P::reference reference;
893  gil_function_requires<PixelConcept<typename remove_const_and_reference<reference>::type> >();
894 
895  typedef typename P::const_reference const_reference;
896  gil_function_requires<PixelConcept<typename remove_const_and_reference<const_reference>::type> >();
897  }
898 };
899 
900 
903 
910 template <typename P>
912  void constraints() {
913  gil_function_requires<PixelConcept<P> >();
914  BOOST_STATIC_ASSERT(P::is_mutable);
915  }
916 };
919 
926 template <typename P>
928  void constraints() {
929  gil_function_requires<PixelConcept<P> >();
930  gil_function_requires<HomogeneousColorBaseConcept<P> >();
931  gil_function_requires<HomogeneousPixelBasedConcept<P> >();
932  p[0];
933  }
934  P p;
935 };
936 
939 
946 template <typename P>
948  void constraints() {
949  gil_function_requires<HomogeneousPixelConcept<P> >();
950  gil_function_requires<MutableHomogeneousColorBaseConcept<P> >();
951  p[0]=v;
952  v=p[0];
953  }
954  typename P::template element_type<P>::type v;
955  P p;
956 };
957 
960 
967 template <typename P>
969  void constraints() {
970  gil_function_requires<PixelConcept<P> >();
971  gil_function_requires<Regular<P> >();
972  }
973 };
974 
977 
984 template <typename P>
986  void constraints() {
987  gil_function_requires<HomogeneousPixelConcept<P> >();
988  gil_function_requires<Regular<P> >();
989  BOOST_STATIC_ASSERT((is_same<P, typename P::value_type>::value));
990  }
991 };
992 
993 namespace detail {
994  template <typename P1, typename P2, int K>
995  struct channels_are_pairwise_compatible : public
996  mpl::and_<channels_are_pairwise_compatible<P1,P2,K-1>,
997  channels_are_compatible<typename kth_semantic_element_reference_type<P1,K>::type,
998  typename kth_semantic_element_reference_type<P2,K>::type> > {};
999 
1000  template <typename P1, typename P2>
1001  struct channels_are_pairwise_compatible<P1,P2,-1> : public mpl::true_ {};
1002 }
1003 
1008 template <typename P1, typename P2> // Models GIL Pixel
1010  : public mpl::and_<typename color_spaces_are_compatible<typename color_space_type<P1>::type,
1011  typename color_space_type<P2>::type>::type,
1012  detail::channels_are_pairwise_compatible<P1,P2,num_channels<P1>::value-1> > {};
1013 
1017 
1025 template <typename P1, typename P2> // precondition: P1 and P2 model PixelConcept
1027  void constraints() {
1028  BOOST_STATIC_ASSERT((pixels_are_compatible<P1,P2>::value));
1029  }
1030 };
1031 
1036 
1044 template <typename SrcP, typename DstP>
1046  void constraints() {
1047  gil_function_requires<PixelConcept<SrcP> >();
1048  gil_function_requires<MutablePixelConcept<DstP> >();
1049  color_convert(src,dst);
1050  }
1051  SrcP src;
1052  DstP dst;
1053 };
1054 
1060 
1062 
1066 
1081 template <typename D>
1083  void constraints() {
1084  gil_function_requires< boost::UnaryFunctionConcept<D,
1085  typename remove_const_and_reference<typename D::result_type>::type,
1086  typename D::argument_type> >();
1087  gil_function_requires< boost::DefaultConstructibleConcept<D> >();
1088  gil_function_requires< boost::CopyConstructibleConcept<D> >();
1089  gil_function_requires< boost::AssignableConcept<D> >();
1090 
1091  gil_function_requires<PixelConcept<typename remove_const_and_reference<typename D::result_type>::type> >();
1092 
1093  typedef typename D::const_t const_t;
1094  gil_function_requires<PixelDereferenceAdaptorConcept<const_t> >();
1095  typedef typename D::value_type value_type;
1096  gil_function_requires<PixelValueConcept<value_type> >();
1097  typedef typename D::reference reference; // == PixelConcept (if you remove const and reference)
1098  typedef typename D::const_reference const_reference; // == PixelConcept (if you remove const and reference)
1099 
1100  const bool is_mutable=D::is_mutable; ignore_unused_variable_warning(is_mutable);
1101  }
1102  D d;
1103 };
1104 
1105 template <typename P>
1106 struct PixelDereferenceAdaptorArchetype {
1107  typedef P argument_type;
1108  typedef P result_type;
1109  typedef PixelDereferenceAdaptorArchetype const_t;
1110  typedef typename remove_reference<P>::type value_type;
1111  typedef typename add_reference<P>::type reference;
1112  typedef reference const_reference;
1113  static const bool is_mutable=false;
1114  P operator()(P) const { throw; }
1115 };
1116 
1122 
1125 
1133 template <typename T>
1135  void constraints() {
1136  typedef typename dynamic_x_step_type<T>::type type;
1137  }
1138 };
1139 
1142 
1150 template <typename T>
1152  void constraints() {
1153  typedef typename dynamic_y_step_type<T>::type type;
1154  }
1155 };
1156 
1157 
1160 
1168 template <typename T>
1170  void constraints() {
1171  typedef typename transposed_type<T>::type type;
1172  }
1173 };
1174 
1178 
1181 
1197 template <typename Iterator>
1199  void constraints() {
1200  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1201  gil_function_requires<PixelBasedConcept<Iterator> >();
1202 
1203  typedef typename std::iterator_traits<Iterator>::value_type value_type;
1204  gil_function_requires<PixelValueConcept<value_type> >();
1205 
1206  typedef typename const_iterator_type<Iterator>::type const_t;
1207  static const bool is_mut = iterator_is_mutable<Iterator>::type::value; ignore_unused_variable_warning(is_mut);
1208 
1209  const_t const_it(it); ignore_unused_variable_warning(const_it); // immutable iterator must be constructible from (possibly mutable) iterator
1210 
1211  check_base(typename is_iterator_adaptor<Iterator>::type());
1212  }
1213  void check_base(mpl::false_) {}
1214  void check_base(mpl::true_) {
1215  typedef typename iterator_adaptor_get_base<Iterator>::type base_t;
1216  gil_function_requires<PixelIteratorConcept<base_t> >();
1217  }
1218 
1219  Iterator it;
1220 };
1221 
1222 namespace detail {
1223  template <typename Iterator> // Preconditions: Iterator Models PixelIteratorConcept
1224  struct PixelIteratorIsMutableConcept {
1225  void constraints() {
1226  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<Iterator> >();
1227  typedef typename remove_reference<typename std::iterator_traits<Iterator>::reference>::type ref;
1228  typedef typename element_type<ref>::type channel_t;
1229  gil_function_requires<detail::ChannelIsMutableConcept<channel_t> >();
1230  }
1231  };
1232 }
1233 
1236 
1242 template <typename Iterator>
1244  void constraints() {
1245  gil_function_requires<PixelIteratorConcept<Iterator> >();
1246  gil_function_requires<detail::PixelIteratorIsMutableConcept<Iterator> >();
1247  }
1248 };
1249 
1250 namespace detail {
1251  // Iterators that can be used as the base of memory_based_step_iterator require some additional functions
1252  template <typename Iterator> // Preconditions: Iterator Models boost_concepts::RandomAccessTraversalConcept
1253  struct RandomAccessIteratorIsMemoryBasedConcept {
1254  void constraints() {
1255  std::ptrdiff_t bs=memunit_step(it); ignore_unused_variable_warning(bs);
1256  it=memunit_advanced(it,3);
1257  std::ptrdiff_t bd=memunit_distance(it,it); ignore_unused_variable_warning(bd);
1258  memunit_advance(it,3);
1259  // for performace you may also provide a customized implementation of memunit_advanced_ref
1260  }
1261  Iterator it;
1262  };
1263 }
1264 
1268 
1271 
1283 template <typename Iterator>
1285  void constraints() {
1286  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1287  gil_function_requires<detail::RandomAccessIteratorIsMemoryBasedConcept<Iterator> >();
1288  }
1289 };
1290 
1295 
1302 template <typename Iterator>
1304  void constraints() {
1305  gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1306  it.set_step(0);
1307  }
1308  Iterator it;
1309 };
1310 
1311 
1315 
1320 template <typename Iterator>
1322  void constraints() {
1323  gil_function_requires<StepIteratorConcept<Iterator> >();
1324  gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1325  }
1326 };
1327 
1331 
1334 
1359 template <typename Iterator>
1361  void constraints() {
1362  gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1363 
1364  typedef typename iterator_adaptor_get_base<Iterator>::type base_t;
1365  gil_function_requires<boost_concepts::ForwardTraversalConcept<base_t> >();
1366 
1367  BOOST_STATIC_ASSERT(is_iterator_adaptor<Iterator>::value);
1368  typedef typename iterator_adaptor_rebind<Iterator, void*>::type rebind_t;
1369 
1370  base_t base=it.base(); ignore_unused_variable_warning(base);
1371  }
1372  Iterator it;
1373 };
1374 
1377 
1382 template <typename Iterator>
1384  void constraints() {
1385  gil_function_requires<IteratorAdaptorConcept<Iterator> >();
1386  gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1387  }
1388 };
1389 
1395 
1399 
1403 
1407 
1410 
1456 template <typename Loc>
1458  void constraints() {
1459  gil_function_requires< Regular<Loc> >();
1460 
1461  typedef typename Loc::value_type value_type;
1462  typedef typename Loc::reference reference; // result of dereferencing
1463  typedef typename Loc::difference_type difference_type; // result of operator-(pixel_locator, pixel_locator)
1464  typedef typename Loc::cached_location_t cached_location_t; // type used to store relative location (to allow for more efficient repeated access)
1465  typedef typename Loc::const_t const_t; // same as this type, but over const values
1466  typedef typename Loc::point_t point_t; // same as difference_type
1467  static const std::size_t N=Loc::num_dimensions; ignore_unused_variable_warning(N);
1468 
1469  typedef typename Loc::template axis<0>::iterator first_it_type;
1470  typedef typename Loc::template axis<N-1>::iterator last_it_type;
1471  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type> >();
1472  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type> >();
1473 
1474  // point_t must be an N-dimensional point, each dimension of which must have the same type as difference_type of the corresponding iterator
1475  gil_function_requires<PointNDConcept<point_t> >();
1476  BOOST_STATIC_ASSERT(point_t::num_dimensions==N);
1477  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1478  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1479 
1480  difference_type d;
1481  loc+=d;
1482  loc-=d;
1483  loc=loc+d;
1484  loc=loc-d;
1485  reference r1=loc[d]; ignore_unused_variable_warning(r1);
1486  reference r2=*loc; ignore_unused_variable_warning(r2);
1487  cached_location_t cl=loc.cache_location(d); ignore_unused_variable_warning(cl);
1488  reference r3=loc[d]; ignore_unused_variable_warning(r3);
1489 
1490  first_it_type fi=loc.template axis_iterator<0>();
1491  fi=loc.template axis_iterator<0>(d);
1492  last_it_type li=loc.template axis_iterator<N-1>();
1493  li=loc.template axis_iterator<N-1>(d);
1494 
1495  typedef PixelDereferenceAdaptorArchetype<typename Loc::value_type> deref_t;
1496  typedef typename Loc::template add_deref<deref_t>::type dtype;
1497  //gil_function_requires<RandomAccessNDLocatorConcept<dtype> >(); // infinite recursion
1498  }
1499  Loc loc;
1500 };
1501 
1504 
1542 template <typename Loc>
1544  void constraints() {
1545  gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1546  BOOST_STATIC_ASSERT(Loc::num_dimensions==2);
1547 
1548  typedef typename dynamic_x_step_type<Loc>::type dynamic_x_step_t;
1549  typedef typename dynamic_y_step_type<Loc>::type dynamic_y_step_t;
1550  typedef typename transposed_type<Loc>::type transposed_t;
1551 
1552  typedef typename Loc::cached_location_t cached_location_t;
1553  gil_function_requires<Point2DConcept<typename Loc::point_t> >();
1554 
1555  typedef typename Loc::x_iterator x_iterator;
1556  typedef typename Loc::y_iterator y_iterator;
1557  typedef typename Loc::x_coord_t x_coord_t;
1558  typedef typename Loc::y_coord_t y_coord_t;
1559 
1560  x_coord_t xd=0; ignore_unused_variable_warning(xd);
1561  y_coord_t yd=0; ignore_unused_variable_warning(yd);
1562 
1563  typename Loc::difference_type d;
1564  typename Loc::reference r=loc(xd,yd); ignore_unused_variable_warning(r);
1565 
1566  dynamic_x_step_t loc2(dynamic_x_step_t(), yd);
1567  dynamic_x_step_t loc3(dynamic_x_step_t(), xd, yd);
1568 
1569  typedef typename dynamic_y_step_type<typename dynamic_x_step_type<transposed_t>::type>::type dynamic_xy_step_transposed_t;
1570  dynamic_xy_step_transposed_t loc4(loc, xd,yd,true);
1571 
1572  bool is_contiguous=loc.is_1d_traversable(xd); ignore_unused_variable_warning(is_contiguous);
1573  loc.y_distance_to(loc, xd);
1574 
1575  loc=loc.xy_at(d);
1576  loc=loc.xy_at(xd,yd);
1577 
1578  x_iterator xit=loc.x_at(d);
1579  xit=loc.x_at(xd,yd);
1580  xit=loc.x();
1581 
1582  y_iterator yit=loc.y_at(d);
1583  yit=loc.y_at(xd,yd);
1584  yit=loc.y();
1585 
1586  cached_location_t cl=loc.cache_location(xd,yd); ignore_unused_variable_warning(cl);
1587  }
1588  Loc loc;
1589 };
1590 
1593 
1605 template <typename Loc>
1607  void constraints() {
1608  gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1609  gil_function_requires< PixelIteratorConcept<typename Loc::x_iterator> >();
1610  gil_function_requires< PixelIteratorConcept<typename Loc::y_iterator> >();
1611  typedef typename Loc::coord_t coord_t;
1612  BOOST_STATIC_ASSERT((is_same<typename Loc::x_coord_t, typename Loc::y_coord_t>::value));
1613  }
1614  Loc loc;
1615 };
1616 
1617 namespace detail {
1618  template <typename Loc> // preconditions: Loc Models RandomAccessNDLocatorConcept
1619  struct RandomAccessNDLocatorIsMutableConcept {
1620  void constraints() {
1621  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename Loc::template axis<0>::iterator> >();
1622  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename Loc::template axis<Loc::num_dimensions-1>::iterator> >();
1623 
1624  typename Loc::difference_type d; initialize_it(d);
1625  typename Loc::value_type v;initialize_it(v);
1626  typename Loc::cached_location_t cl=loc.cache_location(d);
1627  *loc=v;
1628  loc[d]=v;
1629  loc[cl]=v;
1630  }
1631  Loc loc;
1632  };
1633 
1634  template <typename Loc> // preconditions: Loc Models RandomAccess2DLocatorConcept
1635  struct RandomAccess2DLocatorIsMutableConcept {
1636  void constraints() {
1637  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1638  typename Loc::x_coord_t xd=0; ignore_unused_variable_warning(xd);
1639  typename Loc::y_coord_t yd=0; ignore_unused_variable_warning(yd);
1640  typename Loc::value_type v; initialize_it(v);
1641  loc(xd,yd)=v;
1642  }
1643  Loc loc;
1644  };
1645 }
1646 
1649 
1656 template <typename Loc>
1658  void constraints() {
1659  gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1660  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1661  }
1662 };
1663 
1666 
1671 template <typename Loc>
1673  void constraints() {
1674  gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1675  gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1676  }
1677 };
1678 
1681 
1686 template <typename Loc>
1688  void constraints() {
1689  gil_function_requires<PixelLocatorConcept<Loc> >();
1690  gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1691  }
1692 };
1693 
1699 
1703 
1707 
1711 
1714 
1763 template <typename View>
1765  void constraints() {
1766  gil_function_requires< Regular<View> >();
1767 
1768  typedef typename View::value_type value_type;
1769  typedef typename View::reference reference; // result of dereferencing
1770  typedef typename View::pointer pointer;
1771  typedef typename View::difference_type difference_type; // result of operator-(1d_iterator,1d_iterator)
1772  typedef typename View::const_t const_t; // same as this type, but over const values
1773  typedef typename View::point_t point_t; // N-dimensional point
1774  typedef typename View::locator locator; // N-dimensional locator
1775  typedef typename View::iterator iterator;
1776  typedef typename View::const_iterator const_iterator;
1777  typedef typename View::reverse_iterator reverse_iterator;
1778  typedef typename View::size_type size_type;
1779  static const std::size_t N=View::num_dimensions;
1780 
1781  gil_function_requires<RandomAccessNDLocatorConcept<locator> >();
1782  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<iterator> >();
1783  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<reverse_iterator> >();
1784 
1785  typedef typename View::template axis<0>::iterator first_it_type;
1786  typedef typename View::template axis<N-1>::iterator last_it_type;
1787  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type> >();
1788  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type> >();
1789 
1790 // BOOST_STATIC_ASSERT((typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1791 // BOOST_STATIC_ASSERT((typename std::iterator_traits< last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1792 
1793  // point_t must be an N-dimensional point, each dimension of which must have the same type as difference_type of the corresponding iterator
1794  gil_function_requires<PointNDConcept<point_t> >();
1795  BOOST_STATIC_ASSERT(point_t::num_dimensions==N);
1796  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1797  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1798 
1799  point_t p;
1800  locator lc;
1801  iterator it;
1802  reverse_iterator rit;
1803  difference_type d; detail::initialize_it(d); ignore_unused_variable_warning(d);
1804 
1805  View(p,lc); // view must be constructible from a locator and a point
1806 
1807  p=view.dimensions();
1808  lc=view.pixels();
1809  size_type sz=view.size(); ignore_unused_variable_warning(sz);
1810  bool is_contiguous=view.is_1d_traversable(); ignore_unused_variable_warning(is_contiguous);
1811 
1812  it=view.begin();
1813  it=view.end();
1814  rit=view.rbegin();
1815  rit=view.rend();
1816 
1817  reference r1=view[d]; ignore_unused_variable_warning(r1); // 1D access
1818  reference r2=view(p); ignore_unused_variable_warning(r2); // 2D access
1819 
1820  // get 1-D iterator of any dimension at a given pixel location
1821  first_it_type fi=view.template axis_iterator<0>(p); ignore_unused_variable_warning(fi);
1822  last_it_type li=view.template axis_iterator<N-1>(p); ignore_unused_variable_warning(li);
1823 
1824  typedef PixelDereferenceAdaptorArchetype<typename View::value_type> deref_t;
1825  typedef typename View::template add_deref<deref_t>::type dtype;
1826  }
1827  View view;
1828 };
1829 
1832 
1869 template <typename View>
1871  void constraints() {
1872  gil_function_requires<RandomAccessNDImageViewConcept<View> >();
1873  BOOST_STATIC_ASSERT(View::num_dimensions==2);
1874 
1875  // TODO: This executes the requirements for RandomAccessNDLocatorConcept again. Fix it to improve compile time
1876  gil_function_requires<RandomAccess2DLocatorConcept<typename View::locator> >();
1877 
1878  typedef typename dynamic_x_step_type<View>::type dynamic_x_step_t;
1879  typedef typename dynamic_y_step_type<View>::type dynamic_y_step_t;
1880  typedef typename transposed_type<View>::type transposed_t;
1881 
1882  typedef typename View::x_iterator x_iterator;
1883  typedef typename View::y_iterator y_iterator;
1884  typedef typename View::x_coord_t x_coord_t;
1885  typedef typename View::y_coord_t y_coord_t;
1886  typedef typename View::xy_locator xy_locator;
1887 
1888  x_coord_t xd=0; ignore_unused_variable_warning(xd);
1889  y_coord_t yd=0; ignore_unused_variable_warning(yd);
1890  x_iterator xit;
1891  y_iterator yit;
1892  typename View::point_t d;
1893 
1894  View(xd,yd,xy_locator()); // constructible with width, height, 2d_locator
1895 
1896  xy_locator lc=view.xy_at(xd,yd);
1897  lc=view.xy_at(d);
1898 
1899  typename View::reference r=view(xd,yd); ignore_unused_variable_warning(r);
1900  xd=view.width();
1901  yd=view.height();
1902 
1903  xit=view.x_at(d);
1904  xit=view.x_at(xd,yd);
1905  xit=view.row_begin(xd);
1906  xit=view.row_end(xd);
1907 
1908  yit=view.y_at(d);
1909  yit=view.y_at(xd,yd);
1910  yit=view.col_begin(xd);
1911  yit=view.col_end(xd);
1912  }
1913  View view;
1914 };
1915 
1919 template <typename View>
1921 {
1922  void constraints()
1923  {
1924  using value_type = typename View::value_type;
1925  using iterator = typename View::iterator;
1926  using const_iterator = typename View::const_iterator;
1927  using reference = typename View::reference;
1928  using const_reference = typename View::const_reference;
1929  using pointer = typename View::pointer;
1930  using difference_type = typename View::difference_type;
1931  using size_type= typename View::size_type;
1932 
1933  iterator i;
1934  i = view1.begin();
1935  i = view2.end();
1936 
1937  const_iterator ci;
1938  ci = view1.begin();
1939  ci = view2.end();
1940 
1941  size_type s;
1942  s = view1.size();
1943  s = view2.size();
1944  boost::ignore_unused(s);
1945 
1946  view1.empty();
1947 
1948  view1.swap(view2);
1949  }
1950  View view1;
1951  View view2;
1952 };
1953 
1957 template <typename View>
1959 {
1960  void constraints()
1961  {
1962  gil_function_requires<CollectionImageViewConcept<View>>();
1963 
1964  using reference = typename View::reference;
1965  using const_reference = typename View::const_reference;
1966 
1967  reference r = view.front();
1968  boost::ignore_unused(r);
1969 
1970  const_reference cr = view.front();
1971  boost::ignore_unused(cr);
1972  }
1973  View view;
1974 };
1975 
1979 template <typename View>
1981 {
1982  void constraints()
1983  {
1984  gil_function_requires<CollectionImageViewConcept<View>>();
1985 
1986  using reverse_iterator = typename View::reverse_iterator;
1987  using reference = typename View::reference;
1988  using const_reference = typename View::const_reference;
1989 
1990  reverse_iterator i;
1991  i = view.rbegin();
1992  i = view.rend();
1993 
1994  reference r = view.back();
1995  boost::ignore_unused(r);
1996 
1997  const_reference cr = view.back();
1998  boost::ignore_unused(cr);
1999  }
2000  View view;
2001 };
2002 
2005 
2019 template <typename View>
2021  void constraints() {
2022  gil_function_requires<RandomAccess2DImageViewConcept<View> >();
2023 
2024  // TODO: This executes the requirements for RandomAccess2DLocatorConcept again. Fix it to improve compile time
2025  gil_function_requires<PixelLocatorConcept<typename View::xy_locator> >();
2026 
2027  BOOST_STATIC_ASSERT((is_same<typename View::x_coord_t, typename View::y_coord_t>::value));
2028 
2029  typedef typename View::coord_t coord_t; // 1D difference type (same for all dimensions)
2030  std::size_t num_chan = view.num_channels(); ignore_unused_variable_warning(num_chan);
2031  }
2032  View view;
2033 };
2034 
2035 
2036 namespace detail {
2037  template <typename View> // Preconditions: View Models RandomAccessNDImageViewConcept
2038  struct RandomAccessNDImageViewIsMutableConcept {
2039  void constraints() {
2040  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<typename View::locator> >();
2041 
2042  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::iterator> >();
2043  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::reverse_iterator> >();
2044  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::template axis<0>::iterator> >();
2045  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::template axis<View::num_dimensions-1>::iterator> >();
2046 
2047  typename View::difference_type diff; initialize_it(diff); ignore_unused_variable_warning(diff);
2048  typename View::point_t pt;
2049  typename View::value_type v; initialize_it(v);
2050 
2051  view[diff]=v;
2052  view(pt)=v;
2053  }
2054  View view;
2055  };
2056 
2057  template <typename View> // preconditions: View Models RandomAccessNDImageViewConcept
2058  struct RandomAccess2DImageViewIsMutableConcept {
2059  void constraints() {
2060  gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
2061  typename View::x_coord_t xd=0; ignore_unused_variable_warning(xd);
2062  typename View::y_coord_t yd=0; ignore_unused_variable_warning(yd);
2063  typename View::value_type v; initialize_it(v);
2064  view(xd,yd)=v;
2065  }
2066  View view;
2067  };
2068 
2069  template <typename View> // preconditions: View Models ImageViewConcept
2070  struct PixelImageViewIsMutableConcept {
2071  void constraints() {
2072  gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2073  }
2074  };
2075 }
2076 
2079 
2086 template <typename View>
2088  void constraints() {
2089  gil_function_requires<RandomAccessNDImageViewConcept<View> >();
2090  gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
2091  }
2092 };
2093 
2096 
2101 template <typename View>
2103  void constraints() {
2104  gil_function_requires<RandomAccess2DImageViewConcept<View> >();
2105  gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2106  }
2107 };
2108 
2111 
2116 template <typename View>
2118  void constraints() {
2119  gil_function_requires<ImageViewConcept<View> >();
2120  gil_function_requires<detail::PixelImageViewIsMutableConcept<View> >();
2121  }
2122 };
2123 
2127 template <typename V1, typename V2> // Model ImageViewConcept
2128 struct views_are_compatible : public pixels_are_compatible<typename V1::value_type, typename V2::value_type> {};
2129 
2132 
2139 template <typename V1, typename V2>
2141  void constraints() {
2142  BOOST_STATIC_ASSERT((views_are_compatible<V1,V2>::value));
2143  }
2144 };
2145 
2151 
2152 
2155 
2176 template <typename Img>
2178  void constraints() {
2179  gil_function_requires<Regular<Img> >();
2180 
2181  typedef typename Img::view_t view_t;
2182  gil_function_requires<MutableRandomAccessNDImageViewConcept<view_t> >();
2183 
2184  typedef typename Img::const_view_t const_view_t;
2185  typedef typename Img::value_type pixel_t;
2186 
2187  typedef typename Img::point_t point_t;
2188  gil_function_requires<PointNDConcept<point_t> >();
2189 
2190  const_view_t cv = const_view(img); ignore_unused_variable_warning(cv);
2191  view_t v = view(img); ignore_unused_variable_warning(v);
2192 
2193  pixel_t fill_value;
2194  point_t pt=img.dimensions();
2195  Img im1(pt);
2196  Img im2(pt,1);
2197  Img im3(pt,fill_value,1);
2198  img.recreate(pt);
2199  img.recreate(pt,1);
2200  img.recreate(pt,fill_value,1);
2201  }
2202  Img img;
2203 };
2204 
2205 
2208 
2225 template <typename Img>
2227  void constraints() {
2228  gil_function_requires<RandomAccessNDImageConcept<Img> >();
2229  typedef typename Img::x_coord_t x_coord_t;
2230  typedef typename Img::y_coord_t y_coord_t;
2231  typedef typename Img::value_type value_t;
2232 
2233  gil_function_requires<MutableRandomAccess2DImageViewConcept<typename Img::view_t> >();
2234 
2235  x_coord_t w=img.width();
2236  y_coord_t h=img.height();
2237  value_t fill_value;
2238  Img im1(w,h);
2239  Img im2(w,h,1);
2240  Img im3(w,h,fill_value,1);
2241  img.recreate(w,h);
2242  img.recreate(w,h,1);
2243  img.recreate(w,h,fill_value,1);
2244  }
2245  Img img;
2246 };
2247 
2250 
2258 template <typename Img>
2260  void constraints() {
2261  gil_function_requires<RandomAccess2DImageConcept<Img> >();
2262  gil_function_requires<MutableImageViewConcept<typename Img::view_t> >();
2263  typedef typename Img::coord_t coord_t;
2264  BOOST_STATIC_ASSERT(num_channels<Img>::value == mpl::size<typename color_space_type<Img>::type>::value);
2265 
2266  BOOST_STATIC_ASSERT((is_same<coord_t, typename Img::x_coord_t>::value));
2267  BOOST_STATIC_ASSERT((is_same<coord_t, typename Img::y_coord_t>::value));
2268  }
2269  Img img;
2270 };
2271 
2272 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
2273 #pragma warning(pop)
2274 #endif
2275 
2276 #if defined(__GNUC__) && (__GNUC__ >= 4)
2277 #pragma GCC diagnostic pop
2278 #endif
2279 
2280 } } // namespace boost::gil
2281 
2282 #endif
Represents a unary function object that can be invoked upon dereferencing a pixel iterator...
Definition: concepts.hpp:1082
Concept for iterators, locators and views that can define a type just like the given iterator/locator...
Definition: concepts.hpp:1134
metafunction predicate determining whether the given iterator is a plain one or an adaptor over anoth...
Definition: concepts.hpp:60
Homogeneous color base that also has a default constructor. Refines Regular.
Definition: concepts.hpp:742
Definition: concepts.hpp:169
Homogeneous pixel concept that allows for changing its channels.
Definition: concepts.hpp:947
2-dimensional view over mutable values
Definition: concepts.hpp:2102
Homogeneous color base that allows for modifying its elements.
Definition: concepts.hpp:720
Pixel iterator that allows for changing its pixel.
Definition: concepts.hpp:1243
Definition: concepts.hpp:183
N-dimensional locator over mutable pixels.
Definition: concepts.hpp:1657
Definition: concepts.hpp:138
Concept of a random-access iterator that can be advanced in memory units (bytes or bits) ...
Definition: concepts.hpp:1284
disable_if< is_const< ColorBase >, typename kth_semantic_element_reference_type< ColorBase, K >::type >::type semantic_at_c(ColorBase &p)
A mutable accessor to the K-th semantic element of a color base.
Definition: color_base_algorithm.hpp:106
2-dimensional locator over mutable pixels
Definition: concepts.hpp:1672
returns the base iterator for a given iterator adaptor. Provide an specialization when introducing ne...
Definition: concepts.hpp:62
Two color bases are compatible if they have the same color space and their elements are compatible...
Definition: concepts.hpp:764
Iterator adaptor is a forward iterator adapting another forward iterator.
Definition: concepts.hpp:1360
Concept for pixel compatibility Pixels are compatible if their channels and color space types are com...
Definition: concepts.hpp:1026
N-dimensional view over mutable values.
Definition: concepts.hpp:2087
void swap(const boost::gil::packed_channel_reference< BF, FB, NB, M > x, R &y)
swap for packed_channel_reference
Definition: channel.hpp:480
Pixel concept that is a Regular type.
Definition: concepts.hpp:968
channel_traits< DstChannel >::value_type channel_convert(const SrcChannel &src)
Converting from one channel type to another.
Definition: channel_algorithm.hpp:398
N-dimensional container of values.
Definition: concepts.hpp:2177
Step iterator that allows for modifying its current value.
Definition: concepts.hpp:1321
Specifies the element type of a homogeneous color base.
Definition: color_base_algorithm.hpp:200
Concept for locators and views that can define a type just like the given locator or view...
Definition: concepts.hpp:1151
Definition: concepts.hpp:198
A channel is convertible to another one if the channel_convert algorithm is defined for the two chann...
Definition: concepts.hpp:542
2-dimensional image whose value type models PixelValueConcept
Definition: concepts.hpp:2259
Heterogeneous pixel reference corresponding to non-byte-aligned bit range. Models ColorBaseConcept...
Definition: bit_aligned_pixel_reference.hpp:113
A color base is a container of color elements (such as channels, channel references or channel pointe...
Definition: concepts.hpp:605
A channel is the building block of a color. Color is defined as a mixture of primary colors and a cha...
Definition: concepts.hpp:437
add_reference< E >::type at_c(detail::homogeneous_color_base< E, L, N > &p)
Provides mutable access to the K-th element, in physical order.
Definition: color_base.hpp:381
Concept for homogeneous pixel-based GIL constructs.
Definition: concepts.hpp:847
Color base which allows for modifying its elements.
Definition: concepts.hpp:648
2-dimensional locator over immutable values
Definition: concepts.hpp:1543
Specifies the return type of the mutable semantic_at_c<K>(color_base);.
Definition: color_base_algorithm.hpp:88
Concept for all pixel-based GIL constructs, such as pixels, iterators, locators, views and images who...
Definition: concepts.hpp:819
GIL view as Collection.
Definition: concepts.hpp:1920
Definition: concepts.hpp:123
Returns whether two views are compatible.
Definition: concepts.hpp:2128
A channel that supports default construction.
Definition: concepts.hpp:491
Concept for locators and views that can define a type just like the given locator or view...
Definition: concepts.hpp:1169
Definition: concepts.hpp:234
Predicate metafunction returning whether two channels are compatibleChannels are considered compatibl...
Definition: concepts.hpp:511
GIL's 2-dimensional locator over immutable GIL pixels.
Definition: concepts.hpp:1606
Channel mapping concept.
Definition: concepts.hpp:398
GIL view as ReversibleCollection.
Definition: concepts.hpp:1980
Homogeneous pixel concept that is a Regular type.
Definition: concepts.hpp:985
Homogeneous pixel concept.
Definition: concepts.hpp:927
Pixel concept that allows for changing its channels.
Definition: concepts.hpp:911
Color space type concept.
Definition: concepts.hpp:363
Definition: concepts.hpp:154
Pixel convertible concept.
Definition: concepts.hpp:1045
Definition: color_convert.hpp:30
GIL's 2-dimensional view over mutable GIL pixels.
Definition: concepts.hpp:2117
Channels are compatible if their associated value types (ignoring constness and references) are the s...
Definition: concepts.hpp:524
2-dimensional container of values
Definition: concepts.hpp:2226
void color_convert(const SrcP &src, DstP &dst)
helper function for converting one pixel to another using GIL default color-converters where ScrP mod...
Definition: color_convert.hpp:296
N-dimensional point concept.
Definition: concepts.hpp:263
Color base that also has a default-constructor. Refines Regular.
Definition: concepts.hpp:672
2-dimensional point concept
Definition: concepts.hpp:300
Changes the base iterator of an iterator adaptor. Provide an specialization when introducing new iter...
Definition: concepts.hpp:61
Returns whether two pixels are compatible.
Definition: concepts.hpp:1009
Iterator adaptor that is mutable.
Definition: concepts.hpp:1383
GIL's 2-dimensional view over immutable GIL pixels.
Definition: concepts.hpp:2020
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:460
Two color spaces are compatible if they are the same.
Definition: concepts.hpp:382
Metafunction predicate returning whether the given iterator allows for changing its values...
Definition: concepts.hpp:59
2-dimensional view over immutable values
Definition: concepts.hpp:1870
Heterogeneous pixel value whose channel references can be constructed from the pixel bitfield and the...
Definition: concepts.hpp:73
Returns an MPL integral type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:45
GIL view as ForwardCollection.
Definition: concepts.hpp:1958
An STL random access traversal iterator over a model of PixelConcept.
Definition: concepts.hpp:1198
const image< Pixel, IsPlanar, Alloc >::const_view_t const_view(const image< Pixel, IsPlanar, Alloc > &img)
Returns the constant-pixel view of an image.
Definition: image.hpp:464
Views are compatible if they have the same color spaces and compatible channel values. Constness and layout are not important for compatibility.
Definition: concepts.hpp:2140
Returns the type of an iterator just like the input iterator, except operating over immutable values...
Definition: concepts.hpp:58
Step iterator concept.
Definition: concepts.hpp:1303
N-dimensional view over immutable values.
Definition: concepts.hpp:1764
Returns the number of channels of a pixel-based GIL construct.
Definition: concepts.hpp:56
A channel that allows for modifying its value.
Definition: concepts.hpp:476
Specifies the return type of the constant semantic_at_c<K>(color_base);.
Definition: color_base_algorithm.hpp:96
Color base whose elements all have the same type.
Definition: concepts.hpp:692
N-dimensional locator over immutable values.
Definition: concepts.hpp:1457
Definition: concepts.hpp:215
Pixel concept - A color base whose elements are channels.
Definition: concepts.hpp:881
2D point both axes of which have the same dimension typeModels: Point2DConcept
Definition: concepts.hpp:42
GIL's 2-dimensional locator over mutable GIL pixels.
Definition: concepts.hpp:1687