Boost GIL


gil_concept.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3 
4  Use, modification and distribution are subject to the Boost Software License,
5  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6  http://www.boost.org/LICENSE_1_0.txt).
7 
8  See http://opensource.adobe.com/gil for most recent version including documentation.
9 */
10 
11 /*************************************************************************************************/
12 
13 #ifndef GIL_CONCEPT_H
14 #define GIL_CONCEPT_H
15 
24 
25 #include <functional>
26 #include "gil_config.hpp"
27 #include <boost/type_traits.hpp>
28 #include <boost/utility/enable_if.hpp>
29 #include <boost/concept_check.hpp>
30 #include <boost/iterator/iterator_concepts.hpp>
31 #include <boost/mpl/and.hpp>
32 #include <boost/mpl/size.hpp>
33 
34 namespace boost { namespace gil {
35 
36 #if defined(__GNUC__) && (__GNUC__ >= 4)
37 #pragma GCC diagnostic push
38 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
39 #endif
40 
41 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
42 #pragma warning(push)
43 #pragma warning(disable:4510) //default constructor could not be generated
44 #pragma warning(disable:4512) //assignment operator could not be generated
45 #pragma warning(disable:4610) //can never be instantiated - user defined constructor required
46 #endif
47 
48 template <typename T> struct channel_traits;
49 template <typename P> struct is_pixel;
50 template <typename dstT, typename srcT>
51 typename channel_traits<dstT>::value_type channel_convert(const srcT& val);
52 template <typename T> class point2;
53 template <std::size_t K, typename T> const T& axis_value(const point2<T>& p);
54 template <std::size_t K, typename T> T& axis_value( point2<T>& p);
55 template <typename ColorBase, int K> struct kth_element_type;
56 template <typename ColorBase, int K> struct kth_element_reference_type;
57 template <typename ColorBase, int K> struct kth_element_const_reference_type;
58 template <typename ColorBase, int K> struct kth_semantic_element_reference_type;
59 template <typename ColorBase, int K> struct kth_semantic_element_const_reference_type;
60 template <typename ColorBase> struct size;
61 template <typename ColorBase> struct element_type;
62 template <typename T> struct channel_type;
63 template <typename T> struct color_space_type;
64 template <typename T> struct channel_mapping_type;
65 template <typename T> struct is_planar;
66 template <typename T> struct num_channels;
67 
68 template <typename It> struct const_iterator_type;
69 template <typename It> struct iterator_is_mutable;
70 template <typename It> struct is_iterator_adaptor;
71 template <typename It, typename NewBaseIt> struct iterator_adaptor_rebind;
72 template <typename It> struct iterator_adaptor_get_base;
73 
74 
75 // forward-declare at_c
76 namespace detail { template <typename Element, typename Layout, int K> struct homogeneous_color_base; }
77 template <int K, typename E, typename L, int N>
78 typename add_reference<E>::type at_c( detail::homogeneous_color_base<E,L,N>& p);
79 
80 template <int K, typename E, typename L, int N>
81 typename add_reference<typename add_const<E>::type>::type at_c(const detail::homogeneous_color_base<E,L,N>& p);
82 
83 #if !defined(_MSC_VER) || _MSC_VER > 1310
84 template <typename P, typename C, typename L> struct packed_pixel;
85 template <int K, typename P, typename C, typename L>
86 typename kth_element_reference_type<packed_pixel<P,C,L>, K>::type
87 at_c(packed_pixel<P,C,L>& p);
88 
89 template <int K, typename P, typename C, typename L>
90 typename kth_element_const_reference_type<packed_pixel<P,C,L>,K>::type
91 at_c(const packed_pixel<P,C,L>& p);
92 
93 template <typename B, typename C, typename L, bool M> struct bit_aligned_pixel_reference;
94 
95 template <int K, typename B, typename C, typename L, bool M> inline
96 typename kth_element_reference_type<bit_aligned_pixel_reference<B,C,L,M>, K>::type
98 #endif
99 
100 // Forward-declare semantic_at_c
101 template <int K, typename ColorBase>
102 typename disable_if<is_const<ColorBase>,typename kth_semantic_element_reference_type<ColorBase,K>::type>::type semantic_at_c(ColorBase& p);
103 template <int K, typename ColorBase>
104 typename kth_semantic_element_const_reference_type<ColorBase,K>::type semantic_at_c(const ColorBase& p);
105 
106 template <typename T> struct dynamic_x_step_type;
107 template <typename T> struct dynamic_y_step_type;
108 template <typename T> struct transposed_type;
109 
110 namespace detail {
111 template <typename T>
112 void initialize_it(T& x) {}
113 } // namespace detail
114 
115 template <typename T>
116 struct remove_const_and_reference : public remove_const<typename remove_reference<T>::type> {};
117 
118 #ifdef BOOST_GIL_USE_CONCEPT_CHECK
119  #define GIL_CLASS_REQUIRE(type_var, ns, concept) BOOST_CLASS_REQUIRE(type_var, ns, concept);
120  template <typename C> void gil_function_requires() { function_requires<C>(); }
121 #else
122  #define GIL_CLASS_REQUIRE(T,NS,C)
123  template <typename C> void gil_function_requires() {}
124 #endif
125 
127 
134 template <typename T>
136  void constraints() {
137  function_requires<boost::DefaultConstructibleConcept<T> >();
138  }
139 };
140 
142 
149 template <typename T>
151  void constraints() {
152  function_requires<boost::CopyConstructibleConcept<T> >();
153  }
154 };
155 
157 
165 template <typename T>
166 struct Assignable {
167  void constraints() {
168  function_requires<boost::AssignableConcept<T> >();
169  }
170 };
172 
180 template <typename T>
182  void constraints() {
183  function_requires<boost::EqualityComparableConcept<T> >();
184  }
185 };
186 
188 
194 template <typename T, typename U>
195 struct SameType {
196  void constraints() {
197  BOOST_STATIC_ASSERT((boost::is_same<T,U>::value_core));
198  }
199 };
200 
202 
209 template <typename T>
210 struct Swappable {
211  void constraints() {
212  using std::swap;
213  swap(x,y);
214  }
215  T x,y;
216 };
217 
219 
226 template <typename T>
227 struct Regular {
228  void constraints() {
229  gil_function_requires< boost::DefaultConstructibleConcept<T> >();
230  gil_function_requires< boost::CopyConstructibleConcept<T> >();
231  gil_function_requires< boost::EqualityComparableConcept<T> >(); // ==, !=
232  gil_function_requires< boost::AssignableConcept<T> >();
233  gil_function_requires< Swappable<T> >();
234  }
235 };
236 
238 
245 template <typename T>
246 struct Metafunction {
247  void constraints() {
248  typedef typename T::type type;
249  }
250 };
252 //
253 // POINT CONCEPTS
254 //
256 
259 
274 template <typename P>
276  void constraints() {
277  gil_function_requires< Regular<P> >();
278 
279  typedef typename P::value_type value_type;
280  static const std::size_t N=P::num_dimensions; ignore_unused_variable_warning(N);
281  typedef typename P::template axis<0>::coord_t FT;
282  typedef typename P::template axis<N-1>::coord_t LT;
283  FT ft=gil::axis_value<0>(point);
284  axis_value<0>(point)=ft;
285  LT lt=axis_value<N-1>(point);
286  axis_value<N-1>(point)=lt;
287 
288 // value_type v=point[0]; ignore_unused_variable_warning(v);
289  }
290  P point;
291 };
292 
295 
311 template <typename P>
313  void constraints() {
314  gil_function_requires< PointNDConcept<P> >();
315  BOOST_STATIC_ASSERT(P::num_dimensions == 2);
316  point.x=point.y;
317  point[0]=point[1];
318  }
319  P point;
320 };
321 
323 //
324 // ITERATOR MUTABILITY CONCEPTS
325 //
326 // Taken from boost's concept_check.hpp. Isolating mutability to result in faster compile time
327 //
329 
330 namespace detail {
331  template <class TT> // Preconditions: TT Models boost_concepts::ForwardTraversalConcept
332  struct ForwardIteratorIsMutableConcept {
333  void constraints() {
334  *i++ = *i; // require postincrement and assignment
335  }
336  TT i;
337  };
338 
339  template <class TT> // Preconditions: TT Models boost::BidirectionalIteratorConcept
340  struct BidirectionalIteratorIsMutableConcept {
341  void constraints() {
342  gil_function_requires< ForwardIteratorIsMutableConcept<TT> >();
343  *i-- = *i; // require postdecrement and assignment
344  }
345  TT i;
346  };
347 
348  template <class TT> // Preconditions: TT Models boost_concepts::RandomAccessTraversalConcept
349  struct RandomAccessIteratorIsMutableConcept {
350  void constraints() {
351  gil_function_requires< BidirectionalIteratorIsMutableConcept<TT> >();
352  typename std::iterator_traits<TT>::difference_type n=0; ignore_unused_variable_warning(n);
353  i[n] = *i; // require element access and assignment
354  }
355  TT i;
356  };
357 } // namespace detail
358 
360 //
361 // COLOR SPACE CONCEPTS
362 //
364 
367 
374 template <typename Cs>
376  void constraints() {
377  // An MPL Random Access Sequence, whose elements are color tags
378  }
379 };
380 
381 template <typename ColorSpace1, typename ColorSpace2> // Models ColorSpaceConcept
382 struct color_spaces_are_compatible : public is_same<ColorSpace1,ColorSpace2> {};
383 
386 
393 template <typename Cs1, typename Cs2>
395  void constraints() {
396  BOOST_STATIC_ASSERT((color_spaces_are_compatible<Cs1,Cs2>::value));
397  }
398 };
399 
402 
409 template <typename CM>
411  void constraints() {
412  // An MPL Random Access Sequence, whose elements model MPLIntegralConstant representing a permutation
413  }
414 };
415 
416 
417 
423 
426 
448 template <typename T>
450  void constraints() {
451  gil_function_requires< boost::EqualityComparableConcept<T> >();
452 
453  typedef typename channel_traits<T>::value_type v;
454  typedef typename channel_traits<T>::reference r;
455  typedef typename channel_traits<T>::pointer p;
456  typedef typename channel_traits<T>::const_reference cr;
457  typedef typename channel_traits<T>::const_pointer cp;
458 
461  }
462 
463  T c;
464 };
465 
466 namespace detail {
467  // Preconditions: T models ChannelConcept
468  template <typename T>
469  struct ChannelIsMutableConcept {
470  void constraints() {
471  c1=c2;
472  using std::swap;
473  swap(c1,c2);
474  }
475  T c1;
476  T c2;
477  };
478 }
479 
482 
487 template <typename T>
489  void constraints() {
490  gil_function_requires<ChannelConcept<T> >();
491  gil_function_requires<detail::ChannelIsMutableConcept<T> >();
492  }
493 };
494 
497 
502 template <typename T>
504  void constraints() {
505  gil_function_requires<ChannelConcept<T> >();
506  gil_function_requires<Regular<T> >();
507  }
508 };
509 
510 
515 
522 template <typename T1, typename T2> // Models GIL Pixel
524  : public is_same<typename channel_traits<T1>::value_type, typename channel_traits<T2>::value_type> {};
525 
528 
535 template <typename T1, typename T2>
537  void constraints() {
538  BOOST_STATIC_ASSERT((channels_are_compatible<T1,T2>::value));
539  }
540 };
541 
546 
553 template <typename SrcChannel, typename DstChannel>
555  void constraints() {
556  gil_function_requires<ChannelConcept<SrcChannel> >();
557  gil_function_requires<MutableChannelConcept<DstChannel> >();
558  dst=channel_convert<DstChannel,SrcChannel>(src); ignore_unused_variable_warning(dst);
559  }
560  SrcChannel src;
561  DstChannel dst;
562 };
563 
564 
565 
566 
567 
573 
576 
616 template <typename ColorBase>
618  void constraints() {
619  gil_function_requires< CopyConstructible<ColorBase> >();
620  gil_function_requires< EqualityComparable<ColorBase> >();
621 
622  typedef typename ColorBase::layout_t::color_space_t color_space_t;
623  gil_function_requires<ColorSpaceConcept<color_space_t> >();
624 
625  typedef typename ColorBase::layout_t::channel_mapping_t channel_mapping_t;
626  // TODO: channel_mapping_t must be an MPL RandomAccessSequence
627 
628  static const std::size_t num_elements = size<ColorBase>::value;
629 
630  typedef typename kth_element_type<ColorBase,num_elements-1>::type TN;
631  typedef typename kth_element_const_reference_type<ColorBase,num_elements-1>::type CR;
632 
633 #if !defined(_MSC_VER) || _MSC_VER > 1310
634  CR cr=gil::at_c<num_elements-1>(cb); ignore_unused_variable_warning(cr);
635 #endif
636 
637  // functions that work for every pixel (no need to require them)
638  semantic_at_c<0>(cb);
639  semantic_at_c<num_elements-1>(cb);
640  // also static_max(cb), static_min(cb), static_fill(cb,value), and all variations of static_for_each(), static_generate(), static_transform()
641  }
642 
643  ColorBase cb;
644 };
645 
648 
661 template <typename ColorBase>
663  void constraints() {
664  gil_function_requires< ColorBaseConcept<ColorBase> >();
665  gil_function_requires< Assignable<ColorBase> >();
666  gil_function_requires< Swappable<ColorBase> >();
667 
668  typedef typename kth_element_reference_type<ColorBase, 0>::type CR;
669 
670 #if !defined(_MSC_VER) || _MSC_VER > 1310
671  CR r=gil::at_c<0>(cb);
672  gil::at_c<0>(cb)=r;
673 #endif
674  }
675 
676  ColorBase cb;
677 };
678 
681 
687 template <typename ColorBase>
689  void constraints() {
690  gil_function_requires< MutableColorBaseConcept<ColorBase> >();
691  gil_function_requires< Regular<ColorBase> >();
692  }
693 };
694 
697 
707 template <typename ColorBase>
709  void constraints() {
710  gil_function_requires< ColorBaseConcept<ColorBase> >();
711 
712  static const std::size_t num_elements = size<ColorBase>::value;
713 
714  typedef typename kth_element_type<ColorBase,0>::type T0;
715  typedef typename kth_element_type<ColorBase,num_elements-1>::type TN;
716 
717  BOOST_STATIC_ASSERT((is_same<T0,TN>::value)); // better than nothing
718  typedef typename kth_element_const_reference_type<ColorBase,0>::type CRef0;
719  CRef0 e0=dynamic_at_c(cb,0);
720  }
721  ColorBase cb;
722 };
723 
726 
735 template <typename ColorBase>
737  void constraints() {
738  gil_function_requires< ColorBaseConcept<ColorBase> >();
739  gil_function_requires< HomogeneousColorBaseConcept<ColorBase> >();
740  typedef typename kth_element_reference_type<ColorBase, 0>::type R0;
741  R0 x=dynamic_at_c(cb,0);
742  dynamic_at_c(cb,0) = dynamic_at_c(cb,0);
743  }
744  ColorBase cb;
745 };
746 
749 
757 template <typename ColorBase>
759  void constraints() {
760  gil_function_requires< MutableHomogeneousColorBaseConcept<ColorBase> >();
761  gil_function_requires< Regular<ColorBase> >();
762  }
763 };
764 
765 
768 
779 template <typename ColorBase1, typename ColorBase2>
781  void constraints() {
782  BOOST_STATIC_ASSERT((is_same<typename ColorBase1::layout_t::color_space_t,
783  typename ColorBase2::layout_t::color_space_t>::value));
784 // typedef typename kth_semantic_element_type<ColorBase1,0>::type e1;
785 // typedef typename kth_semantic_element_type<ColorBase2,0>::type e2;
786 // "e1 is convertible to e2"
787  }
788 };
789 
790 
791 
792 
793 
794 
795 
796 
797 
798 
799 
800 
801 
802 
803 
804 
805 
806 
807 
808 
809 
810 
816 
819 
834 template <typename P>
836  void constraints() {
837  typedef typename color_space_type<P>::type color_space_t;
838  gil_function_requires<ColorSpaceConcept<color_space_t> >();
839  typedef typename channel_mapping_type<P>::type channel_mapping_t;
840  gil_function_requires<ChannelMappingConcept<channel_mapping_t> >();
841 
842  static const bool planar = is_planar<P>::type::value; ignore_unused_variable_warning(planar);
843 
844 
845  // This is not part of the concept, but should still work
846  static const std::size_t nc = num_channels<P>::value;
847  ignore_unused_variable_warning(nc);
848  }
849 };
850 
853 
862 template <typename P>
864  void constraints() {
865  gil_function_requires<PixelBasedConcept<P> >();
866  typedef typename channel_type<P>::type channel_t;
867  gil_function_requires<ChannelConcept<channel_t> >();
868  }
869 };
870 
871 
874 
896 template <typename P>
897 struct PixelConcept {
898  void constraints() {
899  gil_function_requires<ColorBaseConcept<P> >();
900  gil_function_requires<PixelBasedConcept<P> >();
901 
902  BOOST_STATIC_ASSERT((is_pixel<P>::value));
903  static const bool is_mutable = P::is_mutable; ignore_unused_variable_warning(is_mutable);
904 
905  typedef typename P::value_type value_type;
906 // gil_function_requires<PixelValueConcept<value_type> >();
907 
908  typedef typename P::reference reference;
909  gil_function_requires<PixelConcept<typename remove_const_and_reference<reference>::type> >();
910 
911  typedef typename P::const_reference const_reference;
912  gil_function_requires<PixelConcept<typename remove_const_and_reference<const_reference>::type> >();
913  }
914 };
915 
916 
919 
926 template <typename P>
928  void constraints() {
929  gil_function_requires<PixelConcept<P> >();
930  BOOST_STATIC_ASSERT(P::is_mutable);
931  }
932 };
935 
942 template <typename P>
944  void constraints() {
945  gil_function_requires<PixelConcept<P> >();
946  gil_function_requires<HomogeneousColorBaseConcept<P> >();
947  gil_function_requires<HomogeneousPixelBasedConcept<P> >();
948  p[0];
949  }
950  P p;
951 };
952 
955 
962 template <typename P>
964  void constraints() {
965  gil_function_requires<HomogeneousPixelConcept<P> >();
966  gil_function_requires<MutableHomogeneousColorBaseConcept<P> >();
967  p[0]=v;
968  v=p[0];
969  }
970  typename P::template element_type<P>::type v;
971  P p;
972 };
973 
976 
983 template <typename P>
985  void constraints() {
986  gil_function_requires<PixelConcept<P> >();
987  gil_function_requires<Regular<P> >();
988  }
989 };
990 
993 
1000 template <typename P>
1002  void constraints() {
1003  gil_function_requires<HomogeneousPixelConcept<P> >();
1004  gil_function_requires<Regular<P> >();
1005  BOOST_STATIC_ASSERT((is_same<P, typename P::value_type>::value));
1006  }
1007 };
1008 
1009 namespace detail {
1010  template <typename P1, typename P2, int K>
1011  struct channels_are_pairwise_compatible : public
1012  mpl::and_<channels_are_pairwise_compatible<P1,P2,K-1>,
1013  channels_are_compatible<typename kth_semantic_element_reference_type<P1,K>::type,
1014  typename kth_semantic_element_reference_type<P2,K>::type> > {};
1015 
1016  template <typename P1, typename P2>
1017  struct channels_are_pairwise_compatible<P1,P2,-1> : public mpl::true_ {};
1018 }
1019 
1024 template <typename P1, typename P2> // Models GIL Pixel
1026  : public mpl::and_<typename color_spaces_are_compatible<typename color_space_type<P1>::type,
1027  typename color_space_type<P2>::type>::type,
1028  detail::channels_are_pairwise_compatible<P1,P2,num_channels<P1>::value-1> > {};
1029 
1033 
1041 template <typename P1, typename P2> // precondition: P1 and P2 model PixelConcept
1043  void constraints() {
1044  BOOST_STATIC_ASSERT((pixels_are_compatible<P1,P2>::value));
1045  }
1046 };
1047 
1052 
1060 template <typename SrcP, typename DstP>
1062  void constraints() {
1063  gil_function_requires<PixelConcept<SrcP> >();
1064  gil_function_requires<MutablePixelConcept<DstP> >();
1065  color_convert(src,dst);
1066  }
1067  SrcP src;
1068  DstP dst;
1069 };
1070 
1076 
1078 
1082 
1097 template <typename D>
1099  void constraints() {
1100  gil_function_requires< boost::UnaryFunctionConcept<D,
1101  typename remove_const_and_reference<typename D::result_type>::type,
1102  typename D::argument_type> >();
1103  gil_function_requires< boost::DefaultConstructibleConcept<D> >();
1104  gil_function_requires< boost::CopyConstructibleConcept<D> >();
1105  gil_function_requires< boost::AssignableConcept<D> >();
1106 
1107  gil_function_requires<PixelConcept<typename remove_const_and_reference<typename D::result_type>::type> >();
1108 
1109  typedef typename D::const_t const_t;
1110  gil_function_requires<PixelDereferenceAdaptorConcept<const_t> >();
1111  typedef typename D::value_type value_type;
1112  gil_function_requires<PixelValueConcept<value_type> >();
1113  typedef typename D::reference reference; // == PixelConcept (if you remove const and reference)
1114  typedef typename D::const_reference const_reference; // == PixelConcept (if you remove const and reference)
1115 
1116  const bool is_mutable=D::is_mutable; ignore_unused_variable_warning(is_mutable);
1117  }
1118  D d;
1119 };
1120 
1121 template <typename P>
1122 struct PixelDereferenceAdaptorArchetype {
1123  typedef P argument_type;
1124  typedef P result_type;
1125  typedef PixelDereferenceAdaptorArchetype const_t;
1126  typedef typename remove_reference<P>::type value_type;
1127  typedef typename add_reference<P>::type reference;
1128  typedef reference const_reference;
1129  static const bool is_mutable=false;
1130  P operator()(P x) const { throw; }
1131 };
1132 
1138 
1141 
1149 template <typename T>
1151  void constraints() {
1152  typedef typename dynamic_x_step_type<T>::type type;
1153  }
1154 };
1155 
1158 
1166 template <typename T>
1168  void constraints() {
1169  typedef typename dynamic_y_step_type<T>::type type;
1170  }
1171 };
1172 
1173 
1176 
1184 template <typename T>
1186  void constraints() {
1187  typedef typename transposed_type<T>::type type;
1188  }
1189 };
1190 
1194 
1197 
1213 template <typename Iterator>
1215  void constraints() {
1216  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1217  gil_function_requires<PixelBasedConcept<Iterator> >();
1218 
1219  typedef typename std::iterator_traits<Iterator>::value_type value_type;
1220  gil_function_requires<PixelValueConcept<value_type> >();
1221 
1222  typedef typename const_iterator_type<Iterator>::type const_t;
1223  static const bool is_mut = iterator_is_mutable<Iterator>::type::value; ignore_unused_variable_warning(is_mut);
1224 
1225  const_t const_it(it); ignore_unused_variable_warning(const_it); // immutable iterator must be constructible from (possibly mutable) iterator
1226 
1227  check_base(typename is_iterator_adaptor<Iterator>::type());
1228  }
1229  void check_base(mpl::false_) {}
1230  void check_base(mpl::true_) {
1231  typedef typename iterator_adaptor_get_base<Iterator>::type base_t;
1232  gil_function_requires<PixelIteratorConcept<base_t> >();
1233  }
1234 
1235  Iterator it;
1236 };
1237 
1238 namespace detail {
1239  template <typename Iterator> // Preconditions: Iterator Models PixelIteratorConcept
1240  struct PixelIteratorIsMutableConcept {
1241  void constraints() {
1242  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<Iterator> >();
1243  typedef typename remove_reference<typename std::iterator_traits<Iterator>::reference>::type ref;
1244  typedef typename element_type<ref>::type channel_t;
1245  gil_function_requires<detail::ChannelIsMutableConcept<channel_t> >();
1246  }
1247  };
1248 }
1249 
1252 
1258 template <typename Iterator>
1260  void constraints() {
1261  gil_function_requires<PixelIteratorConcept<Iterator> >();
1262  gil_function_requires<detail::PixelIteratorIsMutableConcept<Iterator> >();
1263  }
1264 };
1265 
1266 namespace detail {
1267  // Iterators that can be used as the base of memory_based_step_iterator require some additional functions
1268  template <typename Iterator> // Preconditions: Iterator Models boost_concepts::RandomAccessTraversalConcept
1269  struct RandomAccessIteratorIsMemoryBasedConcept {
1270  void constraints() {
1271  std::ptrdiff_t bs=memunit_step(it); ignore_unused_variable_warning(bs);
1272  it=memunit_advanced(it,3);
1273  std::ptrdiff_t bd=memunit_distance(it,it); ignore_unused_variable_warning(bd);
1274  memunit_advance(it,3);
1275  // for performace you may also provide a customized implementation of memunit_advanced_ref
1276  }
1277  Iterator it;
1278  };
1279 }
1280 
1284 
1287 
1299 template <typename Iterator>
1301  void constraints() {
1302  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1303  gil_function_requires<detail::RandomAccessIteratorIsMemoryBasedConcept<Iterator> >();
1304  }
1305 };
1306 
1311 
1318 template <typename Iterator>
1320  void constraints() {
1321  gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1322  it.set_step(0);
1323  }
1324  Iterator it;
1325 };
1326 
1327 
1331 
1336 template <typename Iterator>
1338  void constraints() {
1339  gil_function_requires<StepIteratorConcept<Iterator> >();
1340  gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1341  }
1342 };
1343 
1347 
1350 
1375 template <typename Iterator>
1377  void constraints() {
1378  gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1379 
1380  typedef typename iterator_adaptor_get_base<Iterator>::type base_t;
1381  gil_function_requires<boost_concepts::ForwardTraversalConcept<base_t> >();
1382 
1383  BOOST_STATIC_ASSERT(is_iterator_adaptor<Iterator>::value);
1384  typedef typename iterator_adaptor_rebind<Iterator, void*>::type rebind_t;
1385 
1386  base_t base=it.base(); ignore_unused_variable_warning(base);
1387  }
1388  Iterator it;
1389 };
1390 
1393 
1398 template <typename Iterator>
1400  void constraints() {
1401  gil_function_requires<IteratorAdaptorConcept<Iterator> >();
1402  gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1403  }
1404 };
1405 
1411 
1415 
1419 
1423 
1426 
1472 template <typename Loc>
1474  void constraints() {
1475  gil_function_requires< Regular<Loc> >();
1476 
1477  typedef typename Loc::value_type value_type;
1478  typedef typename Loc::reference reference; // result of dereferencing
1479  typedef typename Loc::difference_type difference_type; // result of operator-(pixel_locator, pixel_locator)
1480  typedef typename Loc::cached_location_t cached_location_t; // type used to store relative location (to allow for more efficient repeated access)
1481  typedef typename Loc::const_t const_t; // same as this type, but over const values
1482  typedef typename Loc::point_t point_t; // same as difference_type
1483  static const std::size_t N=Loc::num_dimensions; ignore_unused_variable_warning(N);
1484 
1485  typedef typename Loc::template axis<0>::iterator first_it_type;
1486  typedef typename Loc::template axis<N-1>::iterator last_it_type;
1487  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type> >();
1488  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type> >();
1489 
1490  // point_t must be an N-dimensional point, each dimension of which must have the same type as difference_type of the corresponding iterator
1491  gil_function_requires<PointNDConcept<point_t> >();
1492  BOOST_STATIC_ASSERT(point_t::num_dimensions==N);
1493  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1494  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1495 
1496  difference_type d;
1497  loc+=d;
1498  loc-=d;
1499  loc=loc+d;
1500  loc=loc-d;
1501  reference r1=loc[d]; ignore_unused_variable_warning(r1);
1502  reference r2=*loc; ignore_unused_variable_warning(r2);
1503  cached_location_t cl=loc.cache_location(d); ignore_unused_variable_warning(cl);
1504  reference r3=loc[d]; ignore_unused_variable_warning(r3);
1505 
1506  first_it_type fi=loc.template axis_iterator<0>();
1507  fi=loc.template axis_iterator<0>(d);
1508  last_it_type li=loc.template axis_iterator<N-1>();
1509  li=loc.template axis_iterator<N-1>(d);
1510 
1511  typedef PixelDereferenceAdaptorArchetype<typename Loc::value_type> deref_t;
1512  typedef typename Loc::template add_deref<deref_t>::type dtype;
1513  //gil_function_requires<RandomAccessNDLocatorConcept<dtype> >(); // infinite recursion
1514  }
1515  Loc loc;
1516 };
1517 
1520 
1558 template <typename Loc>
1560  void constraints() {
1561  gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1562  BOOST_STATIC_ASSERT(Loc::num_dimensions==2);
1563 
1564  typedef typename dynamic_x_step_type<Loc>::type dynamic_x_step_t;
1565  typedef typename dynamic_y_step_type<Loc>::type dynamic_y_step_t;
1566  typedef typename transposed_type<Loc>::type transposed_t;
1567 
1568  typedef typename Loc::cached_location_t cached_location_t;
1569  gil_function_requires<Point2DConcept<typename Loc::point_t> >();
1570 
1571  typedef typename Loc::x_iterator x_iterator;
1572  typedef typename Loc::y_iterator y_iterator;
1573  typedef typename Loc::x_coord_t x_coord_t;
1574  typedef typename Loc::y_coord_t y_coord_t;
1575 
1576  x_coord_t xd=0; ignore_unused_variable_warning(xd);
1577  y_coord_t yd=0; ignore_unused_variable_warning(yd);
1578 
1579  typename Loc::difference_type d;
1580  typename Loc::reference r=loc(xd,yd); ignore_unused_variable_warning(r);
1581 
1582  dynamic_x_step_t loc2(dynamic_x_step_t(), yd);
1583  dynamic_x_step_t loc3(dynamic_x_step_t(), xd, yd);
1584 
1585  typedef typename dynamic_y_step_type<typename dynamic_x_step_type<transposed_t>::type>::type dynamic_xy_step_transposed_t;
1586  dynamic_xy_step_transposed_t loc4(loc, xd,yd,true);
1587 
1588  bool is_contiguous=loc.is_1d_traversable(xd); ignore_unused_variable_warning(is_contiguous);
1589  loc.y_distance_to(loc, xd);
1590 
1591  loc=loc.xy_at(d);
1592  loc=loc.xy_at(xd,yd);
1593 
1594  x_iterator xit=loc.x_at(d);
1595  xit=loc.x_at(xd,yd);
1596  xit=loc.x();
1597 
1598  y_iterator yit=loc.y_at(d);
1599  yit=loc.y_at(xd,yd);
1600  yit=loc.y();
1601 
1602  cached_location_t cl=loc.cache_location(xd,yd); ignore_unused_variable_warning(cl);
1603  }
1604  Loc loc;
1605 };
1606 
1609 
1621 template <typename Loc>
1623  void constraints() {
1624  gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1625  gil_function_requires< PixelIteratorConcept<typename Loc::x_iterator> >();
1626  gil_function_requires< PixelIteratorConcept<typename Loc::y_iterator> >();
1627  typedef typename Loc::coord_t coord_t;
1628  BOOST_STATIC_ASSERT((is_same<typename Loc::x_coord_t, typename Loc::y_coord_t>::value));
1629  }
1630  Loc loc;
1631 };
1632 
1633 namespace detail {
1634  template <typename Loc> // preconditions: Loc Models RandomAccessNDLocatorConcept
1635  struct RandomAccessNDLocatorIsMutableConcept {
1636  void constraints() {
1637  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename Loc::template axis<0>::iterator> >();
1638  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename Loc::template axis<Loc::num_dimensions-1>::iterator> >();
1639 
1640  typename Loc::difference_type d; initialize_it(d);
1641  typename Loc::value_type v;initialize_it(v);
1642  typename Loc::cached_location_t cl=loc.cache_location(d);
1643  *loc=v;
1644  loc[d]=v;
1645  loc[cl]=v;
1646  }
1647  Loc loc;
1648  };
1649 
1650  template <typename Loc> // preconditions: Loc Models RandomAccess2DLocatorConcept
1651  struct RandomAccess2DLocatorIsMutableConcept {
1652  void constraints() {
1653  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1654  typename Loc::x_coord_t xd=0; ignore_unused_variable_warning(xd);
1655  typename Loc::y_coord_t yd=0; ignore_unused_variable_warning(yd);
1656  typename Loc::value_type v; initialize_it(v);
1657  loc(xd,yd)=v;
1658  }
1659  Loc loc;
1660  };
1661 }
1662 
1665 
1672 template <typename Loc>
1674  void constraints() {
1675  gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1676  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1677  }
1678 };
1679 
1682 
1687 template <typename Loc>
1689  void constraints() {
1690  gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1691  gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1692  }
1693 };
1694 
1697 
1702 template <typename Loc>
1704  void constraints() {
1705  gil_function_requires<PixelLocatorConcept<Loc> >();
1706  gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1707  }
1708 };
1709 
1715 
1719 
1723 
1727 
1730 
1779 template <typename View>
1781  void constraints() {
1782  gil_function_requires< Regular<View> >();
1783 
1784  typedef typename View::value_type value_type;
1785  typedef typename View::reference reference; // result of dereferencing
1786  typedef typename View::difference_type difference_type; // result of operator-(1d_iterator,1d_iterator)
1787  typedef typename View::const_t const_t; // same as this type, but over const values
1788  typedef typename View::point_t point_t; // N-dimensional point
1789  typedef typename View::locator locator; // N-dimensional locator
1790  typedef typename View::iterator iterator;
1791  typedef typename View::reverse_iterator reverse_iterator;
1792  typedef typename View::size_type size_type;
1793  static const std::size_t N=View::num_dimensions;
1794 
1795  gil_function_requires<RandomAccessNDLocatorConcept<locator> >();
1796  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<iterator> >();
1797  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<reverse_iterator> >();
1798 
1799  typedef typename View::template axis<0>::iterator first_it_type;
1800  typedef typename View::template axis<N-1>::iterator last_it_type;
1801  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type> >();
1802  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type> >();
1803 
1804 // BOOST_STATIC_ASSERT((typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1805 // BOOST_STATIC_ASSERT((typename std::iterator_traits< last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1806 
1807  // point_t must be an N-dimensional point, each dimension of which must have the same type as difference_type of the corresponding iterator
1808  gil_function_requires<PointNDConcept<point_t> >();
1809  BOOST_STATIC_ASSERT(point_t::num_dimensions==N);
1810  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1811  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1812 
1813  point_t p;
1814  locator lc;
1815  iterator it;
1816  reverse_iterator rit;
1817  difference_type d; detail::initialize_it(d); ignore_unused_variable_warning(d);
1818 
1819  View(p,lc); // view must be constructible from a locator and a point
1820 
1821  p=view.dimensions();
1822  lc=view.pixels();
1823  size_type sz=view.size(); ignore_unused_variable_warning(sz);
1824  bool is_contiguous=view.is_1d_traversable(); ignore_unused_variable_warning(is_contiguous);
1825 
1826  it=view.begin();
1827  it=view.end();
1828  rit=view.rbegin();
1829  rit=view.rend();
1830 
1831  reference r1=view[d]; ignore_unused_variable_warning(r1); // 1D access
1832  reference r2=view(p); ignore_unused_variable_warning(r2); // 2D access
1833 
1834  // get 1-D iterator of any dimension at a given pixel location
1835  first_it_type fi=view.template axis_iterator<0>(p); ignore_unused_variable_warning(fi);
1836  last_it_type li=view.template axis_iterator<N-1>(p); ignore_unused_variable_warning(li);
1837 
1838  typedef PixelDereferenceAdaptorArchetype<typename View::value_type> deref_t;
1839  typedef typename View::template add_deref<deref_t>::type dtype;
1840  }
1841  View view;
1842 };
1843 
1846 
1883 template <typename View>
1885  void constraints() {
1886  gil_function_requires<RandomAccessNDImageViewConcept<View> >();
1887  BOOST_STATIC_ASSERT(View::num_dimensions==2);
1888 
1889  // TODO: This executes the requirements for RandomAccessNDLocatorConcept again. Fix it to improve compile time
1890  gil_function_requires<RandomAccess2DLocatorConcept<typename View::locator> >();
1891 
1892  typedef typename dynamic_x_step_type<View>::type dynamic_x_step_t;
1893  typedef typename dynamic_y_step_type<View>::type dynamic_y_step_t;
1894  typedef typename transposed_type<View>::type transposed_t;
1895 
1896  typedef typename View::x_iterator x_iterator;
1897  typedef typename View::y_iterator y_iterator;
1898  typedef typename View::x_coord_t x_coord_t;
1899  typedef typename View::y_coord_t y_coord_t;
1900  typedef typename View::xy_locator xy_locator;
1901 
1902  x_coord_t xd=0; ignore_unused_variable_warning(xd);
1903  y_coord_t yd=0; ignore_unused_variable_warning(yd);
1904  x_iterator xit;
1905  y_iterator yit;
1906  typename View::point_t d;
1907 
1908  View(xd,yd,xy_locator()); // constructible with width, height, 2d_locator
1909 
1910  xy_locator lc=view.xy_at(xd,yd);
1911  lc=view.xy_at(d);
1912 
1913  typename View::reference r=view(xd,yd); ignore_unused_variable_warning(r);
1914  xd=view.width();
1915  yd=view.height();
1916 
1917  xit=view.x_at(d);
1918  xit=view.x_at(xd,yd);
1919  xit=view.row_begin(xd);
1920  xit=view.row_end(xd);
1921 
1922  yit=view.y_at(d);
1923  yit=view.y_at(xd,yd);
1924  yit=view.col_begin(xd);
1925  yit=view.col_end(xd);
1926  }
1927  View view;
1928 };
1929 
1930 
1933 
1947 template <typename View>
1949  void constraints() {
1950  gil_function_requires<RandomAccess2DImageViewConcept<View> >();
1951 
1952  // TODO: This executes the requirements for RandomAccess2DLocatorConcept again. Fix it to improve compile time
1953  gil_function_requires<PixelLocatorConcept<typename View::xy_locator> >();
1954 
1955  BOOST_STATIC_ASSERT((is_same<typename View::x_coord_t, typename View::y_coord_t>::value));
1956 
1957  typedef typename View::coord_t coord_t; // 1D difference type (same for all dimensions)
1958  std::size_t num_chan = view.num_channels(); ignore_unused_variable_warning(num_chan);
1959  }
1960  View view;
1961 };
1962 
1963 
1964 namespace detail {
1965  template <typename View> // Preconditions: View Models RandomAccessNDImageViewConcept
1966  struct RandomAccessNDImageViewIsMutableConcept {
1967  void constraints() {
1968  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<typename View::locator> >();
1969 
1970  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::iterator> >();
1971  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::reverse_iterator> >();
1972  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::template axis<0>::iterator> >();
1973  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::template axis<View::num_dimensions-1>::iterator> >();
1974 
1975  typename View::difference_type diff; initialize_it(diff); ignore_unused_variable_warning(diff);
1976  typename View::point_t pt;
1977  typename View::value_type v; initialize_it(v);
1978 
1979  view[diff]=v;
1980  view(pt)=v;
1981  }
1982  View view;
1983  };
1984 
1985  template <typename View> // preconditions: View Models RandomAccessNDImageViewConcept
1986  struct RandomAccess2DImageViewIsMutableConcept {
1987  void constraints() {
1988  gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
1989  typename View::x_coord_t xd=0; ignore_unused_variable_warning(xd);
1990  typename View::y_coord_t yd=0; ignore_unused_variable_warning(yd);
1991  typename View::value_type v; initialize_it(v);
1992  view(xd,yd)=v;
1993  }
1994  View view;
1995  };
1996 
1997  template <typename View> // preconditions: View Models ImageViewConcept
1998  struct PixelImageViewIsMutableConcept {
1999  void constraints() {
2000  gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2001  }
2002  };
2003 }
2004 
2007 
2014 template <typename View>
2016  void constraints() {
2017  gil_function_requires<RandomAccessNDImageViewConcept<View> >();
2018  gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
2019  }
2020 };
2021 
2024 
2029 template <typename View>
2031  void constraints() {
2032  gil_function_requires<RandomAccess2DImageViewConcept<View> >();
2033  gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2034  }
2035 };
2036 
2039 
2044 template <typename View>
2046  void constraints() {
2047  gil_function_requires<ImageViewConcept<View> >();
2048  gil_function_requires<detail::PixelImageViewIsMutableConcept<View> >();
2049  }
2050 };
2051 
2055 template <typename V1, typename V2> // Model ImageViewConcept
2056 struct views_are_compatible : public pixels_are_compatible<typename V1::value_type, typename V2::value_type> {};
2057 
2060 
2067 template <typename V1, typename V2>
2069  void constraints() {
2070  BOOST_STATIC_ASSERT((views_are_compatible<V1,V2>::value));
2071  }
2072 };
2073 
2074 
2080 
2081 
2084 
2105 template <typename Img>
2107  void constraints() {
2108  gil_function_requires<Regular<Img> >();
2109 
2110  typedef typename Img::view_t view_t;
2111  gil_function_requires<MutableRandomAccessNDImageViewConcept<view_t> >();
2112 
2113  typedef typename Img::const_view_t const_view_t;
2114  typedef typename Img::value_type pixel_t;
2115 
2116  typedef typename Img::point_t point_t;
2117  gil_function_requires<PointNDConcept<point_t> >();
2118 
2119  const_view_t cv = const_view(img); ignore_unused_variable_warning(cv);
2120  view_t v = view(img); ignore_unused_variable_warning(v);
2121 
2122  pixel_t fill_value;
2123  point_t pt=img.dimensions();
2124  Img im1(pt);
2125  Img im2(pt,1);
2126  Img im3(pt,fill_value,1);
2127  img.recreate(pt);
2128  img.recreate(pt,1);
2129  img.recreate(pt,fill_value,1);
2130  }
2131  Img img;
2132 };
2133 
2134 
2137 
2154 template <typename Img>
2156  void constraints() {
2157  gil_function_requires<RandomAccessNDImageConcept<Img> >();
2158  typedef typename Img::x_coord_t x_coord_t;
2159  typedef typename Img::y_coord_t y_coord_t;
2160  typedef typename Img::value_type value_t;
2161 
2162  gil_function_requires<MutableRandomAccess2DImageViewConcept<typename Img::view_t> >();
2163 
2164  x_coord_t w=img.width();
2165  y_coord_t h=img.height();
2166  value_t fill_value;
2167  Img im1(w,h);
2168  Img im2(w,h,1);
2169  Img im3(w,h,fill_value,1);
2170  img.recreate(w,h);
2171  img.recreate(w,h,1);
2172  img.recreate(w,h,fill_value,1);
2173  }
2174  Img img;
2175 };
2176 
2179 
2187 template <typename Img>
2189  void constraints() {
2190  gil_function_requires<RandomAccess2DImageConcept<Img> >();
2191  gil_function_requires<MutableImageViewConcept<typename Img::view_t> >();
2192  typedef typename Img::coord_t coord_t;
2193  BOOST_STATIC_ASSERT(num_channels<Img>::value == mpl::size<typename color_space_type<Img>::type>::value);
2194 
2195  BOOST_STATIC_ASSERT((is_same<coord_t, typename Img::x_coord_t>::value));
2196  BOOST_STATIC_ASSERT((is_same<coord_t, typename Img::y_coord_t>::value));
2197  }
2198  Img img;
2199 };
2200 
2201 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
2202 #pragma warning(pop)
2203 #endif
2204 
2205 #if defined(__GNUC__) && (__GNUC__ >= 4)
2206 #pragma GCC diagnostic pop
2207 #endif
2208 
2209 } } // namespace boost::gil
2210 
2211 #endif
Represents a unary function object that can be invoked upon dereferencing a pixel iterator...
Definition: gil_concept.hpp:1098
Concept for iterators, locators and views that can define a type just like the given iterator/locator...
Definition: gil_concept.hpp:1150
metafunction predicate determining whether the given iterator is a plain one or an adaptor over anoth...
Definition: gil_concept.hpp:70
Homogeneous color base that also has a default constructor. Refines Regular.
Definition: gil_concept.hpp:758
Definition: gil_concept.hpp:181
Homogeneous pixel concept that allows for changing its channels.
Definition: gil_concept.hpp:963
2-dimensional view over mutable values
Definition: gil_concept.hpp:2030
Homogeneous color base that allows for modifying its elements.
Definition: gil_concept.hpp:736
Pixel iterator that allows for changing its pixel.
Definition: gil_concept.hpp:1259
Definition: gil_concept.hpp:195
N-dimensional locator over mutable pixels.
Definition: gil_concept.hpp:1673
Definition: gil_concept.hpp:150
Concept of a random-access iterator that can be advanced in memory units (bytes or bits) ...
Definition: gil_concept.hpp:1300
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:122
2-dimensional locator over mutable pixels
Definition: gil_concept.hpp:1688
returns the base iterator for a given iterator adaptor. Provide an specialization when introducing ne...
Definition: gil_concept.hpp:72
Two color bases are compatible if they have the same color space and their elements are compatible...
Definition: gil_concept.hpp:780
Iterator adaptor is a forward iterator adapting another forward iterator.
Definition: gil_concept.hpp:1376
Concept for pixel compatibility Pixels are compatible if their channels and color space types are com...
Definition: gil_concept.hpp:1042
N-dimensional view over mutable values.
Definition: gil_concept.hpp:2015
Pixel concept that is a Regular type.
Definition: gil_concept.hpp:984
channel_traits< DstChannel >::value_type channel_convert(const SrcChannel &src)
Converting from one channel type to another.
Definition: channel_algorithm.hpp:401
N-dimensional container of values.
Definition: gil_concept.hpp:2106
Step iterator that allows for modifying its current value.
Definition: gil_concept.hpp:1337
Specifies the element type of a homogeneous color base.
Definition: color_base_algorithm.hpp:216
Concept for locators and views that can define a type just like the given locator or view...
Definition: gil_concept.hpp:1167
Definition: gil_concept.hpp:210
A channel is convertible to another one if the channel_convert algorithm is defined for the two chann...
Definition: gil_concept.hpp:554
2-dimensional image whose value type models PixelValueConcept
Definition: gil_concept.hpp:2188
Heterogeneous pixel reference corresponding to non-byte-aligned bit range. Models ColorBaseConcept...
Definition: bit_aligned_pixel_reference.hpp:125
A color base is a container of color elements (such as channels, channel references or channel pointe...
Definition: gil_concept.hpp:617
A channel is the building block of a color. Color is defined as a mixture of primary colors and a cha...
Definition: gil_concept.hpp:449
Concept for homogeneous pixel-based GIL constructs.
Definition: gil_concept.hpp:863
Color base which allows for modifying its elements.
Definition: gil_concept.hpp:662
2-dimensional locator over immutable values
Definition: gil_concept.hpp:1559
Specifies the return type of the mutable semantic_at_c<K>(color_base);.
Definition: color_base_algorithm.hpp:104
Concept for all pixel-based GIL constructs, such as pixels, iterators, locators, views and images who...
Definition: gil_concept.hpp:835
Definition: gil_concept.hpp:135
Returns whether two views are compatible.
Definition: gil_concept.hpp:2056
A channel that supports default construction.
Definition: gil_concept.hpp:503
Concept for locators and views that can define a type just like the given locator or view...
Definition: gil_concept.hpp:1185
Definition: gil_concept.hpp:246
Predicate metafunction returning whether two channels are compatibleChannels are considered compatibl...
Definition: gil_concept.hpp:523
GIL's 2-dimensional locator over immutable GIL pixels.
Definition: gil_concept.hpp:1622
Channel mapping concept.
Definition: gil_concept.hpp:410
Homogeneous pixel concept that is a Regular type.
Definition: gil_concept.hpp:1001
Homogeneous pixel concept.
Definition: gil_concept.hpp:943
Pixel concept that allows for changing its channels.
Definition: gil_concept.hpp:927
Color space type concept.
Definition: gil_concept.hpp:375
Definition: gil_concept.hpp:166
Pixel convertible concept.
Definition: gil_concept.hpp:1061
GIL's 2-dimensional view over mutable GIL pixels.
Definition: gil_concept.hpp:2045
Traits for channels. Contains the following members:
Definition: channel.hpp:113
Channels are compatible if their associated value types (ignoring constness and references) are the s...
Definition: gil_concept.hpp:536
2-dimensional container of values
Definition: gil_concept.hpp:2155
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:311
N-dimensional point concept.
Definition: gil_concept.hpp:275
Color base that also has a default-constructor. Refines Regular.
Definition: gil_concept.hpp:688
2-dimensional point concept
Definition: gil_concept.hpp:312
Changes the base iterator of an iterator adaptor. Provide an specialization when introducing new iter...
Definition: gil_concept.hpp:71
Returns whether two pixels are compatible.
Definition: gil_concept.hpp:1025
Iterator adaptor that is mutable.
Definition: gil_concept.hpp:1399
GIL's 2-dimensional view over immutable GIL pixels.
Definition: gil_concept.hpp:1948
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:480
GIL configuration file.
Two color spaces are compatible if they are the same.
Definition: gil_concept.hpp:394
Metafunction predicate returning whether the given iterator allows for changing its values...
Definition: gil_concept.hpp:69
2-dimensional view over immutable values
Definition: gil_concept.hpp:1884
Heterogeneous pixel value whose channel references can be constructed from the pixel bitfield and the...
Definition: gil_concept.hpp:84
Returns an MPL integral type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:61
2D point both axes of which have the same dimension typeModels: Point2DConcept
Definition: gil_concept.hpp:52
An STL random access traversal iterator over a model of PixelConcept.
Definition: gil_concept.hpp:1214
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:484
Views are compatible if they have the same color spaces and compatible channel values. Constness and layout are not important for compatibility.
Definition: gil_concept.hpp:2068
Returns the type of an iterator just like the input iterator, except operating over immutable values...
Definition: gil_concept.hpp:68
Step iterator concept.
Definition: gil_concept.hpp:1319
N-dimensional view over immutable values.
Definition: gil_concept.hpp:1780
Returns the number of channels of a pixel-based GIL construct.
Definition: gil_concept.hpp:66
A channel that allows for modifying its value.
Definition: gil_concept.hpp:488
Specifies the return type of the constant semantic_at_c<K>(color_base);.
Definition: color_base_algorithm.hpp:112
Color base whose elements all have the same type.
Definition: gil_concept.hpp:708
N-dimensional locator over immutable values.
Definition: gil_concept.hpp:1473
Definition: gil_concept.hpp:227
Pixel concept - A color base whose elements are channels.
Definition: gil_concept.hpp:897
GIL's 2-dimensional locator over mutable GIL pixels.
Definition: gil_concept.hpp:1703