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 template <typename P, typename C, typename L> struct packed_pixel;
84 template <int K, typename P, typename C, typename L>
85 typename kth_element_reference_type<packed_pixel<P,C,L>, K>::type
86 at_c(packed_pixel<P,C,L>& p);
87 
88 template <int K, typename P, typename C, typename L>
89 typename kth_element_const_reference_type<packed_pixel<P,C,L>,K>::type
90 at_c(const packed_pixel<P,C,L>& p);
91 
92 template <typename B, typename C, typename L, bool M> struct bit_aligned_pixel_reference;
93 
94 template <int K, typename B, typename C, typename L, bool M> inline
95 typename kth_element_reference_type<bit_aligned_pixel_reference<B,C,L,M>, K>::type
97 
98 // Forward-declare semantic_at_c
99 template <int K, typename ColorBase>
100 typename disable_if<is_const<ColorBase>,typename kth_semantic_element_reference_type<ColorBase,K>::type>::type semantic_at_c(ColorBase& p);
101 template <int K, typename ColorBase>
102 typename kth_semantic_element_const_reference_type<ColorBase,K>::type semantic_at_c(const ColorBase& p);
103 
104 template <typename T> struct dynamic_x_step_type;
105 template <typename T> struct dynamic_y_step_type;
106 template <typename T> struct transposed_type;
107 
108 namespace detail {
109 template <typename T>
110 void initialize_it(T&) {}
111 } // namespace detail
112 
113 template <typename T>
114 struct remove_const_and_reference : public remove_const<typename remove_reference<T>::type> {};
115 
116 #ifdef BOOST_GIL_USE_CONCEPT_CHECK
117  #define GIL_CLASS_REQUIRE(type_var, ns, concept) BOOST_CLASS_REQUIRE(type_var, ns, concept);
118  template <typename C> void gil_function_requires() { function_requires<C>(); }
119 #else
120  #define GIL_CLASS_REQUIRE(T,NS,C)
121  template <typename C> void gil_function_requires() {}
122 #endif
123 
125 
132 template <typename T>
134  void constraints() {
135  function_requires<boost::DefaultConstructibleConcept<T> >();
136  }
137 };
138 
140 
147 template <typename T>
149  void constraints() {
150  function_requires<boost::CopyConstructibleConcept<T> >();
151  }
152 };
153 
155 
163 template <typename T>
164 struct Assignable {
165  void constraints() {
166  function_requires<boost::AssignableConcept<T> >();
167  }
168 };
170 
178 template <typename T>
180  void constraints() {
181  function_requires<boost::EqualityComparableConcept<T> >();
182  }
183 };
184 
186 
192 template <typename T, typename U>
193 struct SameType {
194  void constraints() {
195  BOOST_STATIC_ASSERT((boost::is_same<T,U>::value_core));
196  }
197 };
198 
200 
207 template <typename T>
208 struct Swappable {
209  void constraints() {
210  using std::swap;
211  swap(x,y);
212  }
213  T x,y;
214 };
215 
217 
224 template <typename T>
225 struct Regular {
226  void constraints() {
227  gil_function_requires< boost::DefaultConstructibleConcept<T> >();
228  gil_function_requires< boost::CopyConstructibleConcept<T> >();
229  gil_function_requires< boost::EqualityComparableConcept<T> >(); // ==, !=
230  gil_function_requires< boost::AssignableConcept<T> >();
231  gil_function_requires< Swappable<T> >();
232  }
233 };
234 
236 
243 template <typename T>
244 struct Metafunction {
245  void constraints() {
246  typedef typename T::type type;
247  }
248 };
250 //
251 // POINT CONCEPTS
252 //
254 
257 
272 template <typename P>
274  void constraints() {
275  gil_function_requires< Regular<P> >();
276 
277  typedef typename P::value_type value_type;
278  static const std::size_t N=P::num_dimensions; ignore_unused_variable_warning(N);
279  typedef typename P::template axis<0>::coord_t FT;
280  typedef typename P::template axis<N-1>::coord_t LT;
281  FT ft=gil::axis_value<0>(point);
282  axis_value<0>(point)=ft;
283  LT lt=axis_value<N-1>(point);
284  axis_value<N-1>(point)=lt;
285 
286 // value_type v=point[0]; ignore_unused_variable_warning(v);
287  }
288  P point;
289 };
290 
293 
309 template <typename P>
311  void constraints() {
312  gil_function_requires< PointNDConcept<P> >();
313  BOOST_STATIC_ASSERT(P::num_dimensions == 2);
314  point.x=point.y;
315  point[0]=point[1];
316  }
317  P point;
318 };
319 
321 //
322 // ITERATOR MUTABILITY CONCEPTS
323 //
324 // Taken from boost's concept_check.hpp. Isolating mutability to result in faster compile time
325 //
327 
328 namespace detail {
329  template <class TT> // Preconditions: TT Models boost_concepts::ForwardTraversalConcept
330  struct ForwardIteratorIsMutableConcept {
331  void constraints() {
332  *i++ = *i; // require postincrement and assignment
333  }
334  TT i;
335  };
336 
337  template <class TT> // Preconditions: TT Models boost::BidirectionalIteratorConcept
338  struct BidirectionalIteratorIsMutableConcept {
339  void constraints() {
340  gil_function_requires< ForwardIteratorIsMutableConcept<TT> >();
341  *i-- = *i; // require postdecrement and assignment
342  }
343  TT i;
344  };
345 
346  template <class TT> // Preconditions: TT Models boost_concepts::RandomAccessTraversalConcept
347  struct RandomAccessIteratorIsMutableConcept {
348  void constraints() {
349  gil_function_requires< BidirectionalIteratorIsMutableConcept<TT> >();
350  typename std::iterator_traits<TT>::difference_type n=0; ignore_unused_variable_warning(n);
351  i[n] = *i; // require element access and assignment
352  }
353  TT i;
354  };
355 } // namespace detail
356 
358 //
359 // COLOR SPACE CONCEPTS
360 //
362 
365 
372 template <typename Cs>
374  void constraints() {
375  // An MPL Random Access Sequence, whose elements are color tags
376  }
377 };
378 
379 template <typename ColorSpace1, typename ColorSpace2> // Models ColorSpaceConcept
380 struct color_spaces_are_compatible : public is_same<ColorSpace1,ColorSpace2> {};
381 
384 
391 template <typename Cs1, typename Cs2>
393  void constraints() {
394  BOOST_STATIC_ASSERT((color_spaces_are_compatible<Cs1,Cs2>::value));
395  }
396 };
397 
400 
407 template <typename CM>
409  void constraints() {
410  // An MPL Random Access Sequence, whose elements model MPLIntegralConstant representing a permutation
411  }
412 };
413 
414 
415 
421 
424 
446 template <typename T>
448  void constraints() {
449  gil_function_requires< boost::EqualityComparableConcept<T> >();
450 
451  typedef typename channel_traits<T>::value_type v;
452  typedef typename channel_traits<T>::reference r;
453  typedef typename channel_traits<T>::pointer p;
454  typedef typename channel_traits<T>::const_reference cr;
455  typedef typename channel_traits<T>::const_pointer cp;
456 
459  }
460 
461  T c;
462 };
463 
464 namespace detail {
465  // Preconditions: T models ChannelConcept
466  template <typename T>
467  struct ChannelIsMutableConcept {
468  void constraints() {
469  c1=c2;
470  using std::swap;
471  swap(c1,c2);
472  }
473  T c1;
474  T c2;
475  };
476 }
477 
480 
485 template <typename T>
487  void constraints() {
488  gil_function_requires<ChannelConcept<T> >();
489  gil_function_requires<detail::ChannelIsMutableConcept<T> >();
490  }
491 };
492 
495 
500 template <typename T>
502  void constraints() {
503  gil_function_requires<ChannelConcept<T> >();
504  gil_function_requires<Regular<T> >();
505  }
506 };
507 
508 
513 
520 template <typename T1, typename T2> // Models GIL Pixel
522  : public is_same<typename channel_traits<T1>::value_type, typename channel_traits<T2>::value_type> {};
523 
526 
533 template <typename T1, typename T2>
535  void constraints() {
536  BOOST_STATIC_ASSERT((channels_are_compatible<T1,T2>::value));
537  }
538 };
539 
544 
551 template <typename SrcChannel, typename DstChannel>
553  void constraints() {
554  gil_function_requires<ChannelConcept<SrcChannel> >();
555  gil_function_requires<MutableChannelConcept<DstChannel> >();
556  dst=channel_convert<DstChannel,SrcChannel>(src); ignore_unused_variable_warning(dst);
557  }
558  SrcChannel src;
559  DstChannel dst;
560 };
561 
562 
563 
564 
565 
571 
574 
614 template <typename ColorBase>
616  void constraints() {
617  gil_function_requires< CopyConstructible<ColorBase> >();
618  gil_function_requires< EqualityComparable<ColorBase> >();
619 
620  typedef typename ColorBase::layout_t::color_space_t color_space_t;
621  gil_function_requires<ColorSpaceConcept<color_space_t> >();
622 
623  typedef typename ColorBase::layout_t::channel_mapping_t channel_mapping_t;
624  // TODO: channel_mapping_t must be an MPL RandomAccessSequence
625 
626  static const std::size_t num_elements = size<ColorBase>::value;
627 
628  typedef typename kth_element_type<ColorBase,num_elements-1>::type TN;
629  typedef typename kth_element_const_reference_type<ColorBase,num_elements-1>::type CR;
630 
631  CR cr=gil::at_c<num_elements-1>(cb); ignore_unused_variable_warning(cr);
632 
633  // functions that work for every pixel (no need to require them)
634  semantic_at_c<0>(cb);
635  semantic_at_c<num_elements-1>(cb);
636  // also static_max(cb), static_min(cb), static_fill(cb,value), and all variations of static_for_each(), static_generate(), static_transform()
637  }
638 
639  ColorBase cb;
640 };
641 
644 
657 template <typename ColorBase>
659  void constraints() {
660  gil_function_requires< ColorBaseConcept<ColorBase> >();
661  gil_function_requires< Assignable<ColorBase> >();
662  gil_function_requires< Swappable<ColorBase> >();
663 
664  typedef typename kth_element_reference_type<ColorBase, 0>::type CR;
665 
666  CR r=gil::at_c<0>(cb);
667  gil::at_c<0>(cb)=r;
668  }
669 
670  ColorBase cb;
671 };
672 
675 
681 template <typename ColorBase>
683  void constraints() {
684  gil_function_requires< MutableColorBaseConcept<ColorBase> >();
685  gil_function_requires< Regular<ColorBase> >();
686  }
687 };
688 
691 
701 template <typename ColorBase>
703  void constraints() {
704  gil_function_requires< ColorBaseConcept<ColorBase> >();
705 
706  static const std::size_t num_elements = size<ColorBase>::value;
707 
708  typedef typename kth_element_type<ColorBase,0>::type T0;
709  typedef typename kth_element_type<ColorBase,num_elements-1>::type TN;
710 
711  BOOST_STATIC_ASSERT((is_same<T0,TN>::value)); // better than nothing
712  typedef typename kth_element_const_reference_type<ColorBase,0>::type CRef0;
713  CRef0 e0=dynamic_at_c(cb,0);
714  }
715  ColorBase cb;
716 };
717 
720 
729 template <typename ColorBase>
731  void constraints() {
732  gil_function_requires< ColorBaseConcept<ColorBase> >();
733  gil_function_requires< HomogeneousColorBaseConcept<ColorBase> >();
734  typedef typename kth_element_reference_type<ColorBase, 0>::type R0;
735  R0 x=dynamic_at_c(cb,0);
736  dynamic_at_c(cb,0) = dynamic_at_c(cb,0);
737  }
738  ColorBase cb;
739 };
740 
743 
751 template <typename ColorBase>
753  void constraints() {
754  gil_function_requires< MutableHomogeneousColorBaseConcept<ColorBase> >();
755  gil_function_requires< Regular<ColorBase> >();
756  }
757 };
758 
759 
762 
773 template <typename ColorBase1, typename ColorBase2>
775  void constraints() {
776  BOOST_STATIC_ASSERT((is_same<typename ColorBase1::layout_t::color_space_t,
777  typename ColorBase2::layout_t::color_space_t>::value));
778 // typedef typename kth_semantic_element_type<ColorBase1,0>::type e1;
779 // typedef typename kth_semantic_element_type<ColorBase2,0>::type e2;
780 // "e1 is convertible to e2"
781  }
782 };
783 
784 
785 
786 
787 
788 
789 
790 
791 
792 
793 
794 
795 
796 
797 
798 
799 
800 
801 
802 
803 
804 
810 
813 
828 template <typename P>
830  void constraints() {
831  typedef typename color_space_type<P>::type color_space_t;
832  gil_function_requires<ColorSpaceConcept<color_space_t> >();
833  typedef typename channel_mapping_type<P>::type channel_mapping_t;
834  gil_function_requires<ChannelMappingConcept<channel_mapping_t> >();
835 
836  static const bool planar = is_planar<P>::type::value; ignore_unused_variable_warning(planar);
837 
838 
839  // This is not part of the concept, but should still work
840  static const std::size_t nc = num_channels<P>::value;
841  ignore_unused_variable_warning(nc);
842  }
843 };
844 
847 
856 template <typename P>
858  void constraints() {
859  gil_function_requires<PixelBasedConcept<P> >();
860  typedef typename channel_type<P>::type channel_t;
861  gil_function_requires<ChannelConcept<channel_t> >();
862  }
863 };
864 
865 
868 
890 template <typename P>
891 struct PixelConcept {
892  void constraints() {
893  gil_function_requires<ColorBaseConcept<P> >();
894  gil_function_requires<PixelBasedConcept<P> >();
895 
896  BOOST_STATIC_ASSERT((is_pixel<P>::value));
897  static const bool is_mutable = P::is_mutable; ignore_unused_variable_warning(is_mutable);
898 
899  typedef typename P::value_type value_type;
900 // gil_function_requires<PixelValueConcept<value_type> >();
901 
902  typedef typename P::reference reference;
903  gil_function_requires<PixelConcept<typename remove_const_and_reference<reference>::type> >();
904 
905  typedef typename P::const_reference const_reference;
906  gil_function_requires<PixelConcept<typename remove_const_and_reference<const_reference>::type> >();
907  }
908 };
909 
910 
913 
920 template <typename P>
922  void constraints() {
923  gil_function_requires<PixelConcept<P> >();
924  BOOST_STATIC_ASSERT(P::is_mutable);
925  }
926 };
929 
936 template <typename P>
938  void constraints() {
939  gil_function_requires<PixelConcept<P> >();
940  gil_function_requires<HomogeneousColorBaseConcept<P> >();
941  gil_function_requires<HomogeneousPixelBasedConcept<P> >();
942  p[0];
943  }
944  P p;
945 };
946 
949 
956 template <typename P>
958  void constraints() {
959  gil_function_requires<HomogeneousPixelConcept<P> >();
960  gil_function_requires<MutableHomogeneousColorBaseConcept<P> >();
961  p[0]=v;
962  v=p[0];
963  }
964  typename P::template element_type<P>::type v;
965  P p;
966 };
967 
970 
977 template <typename P>
979  void constraints() {
980  gil_function_requires<PixelConcept<P> >();
981  gil_function_requires<Regular<P> >();
982  }
983 };
984 
987 
994 template <typename P>
996  void constraints() {
997  gil_function_requires<HomogeneousPixelConcept<P> >();
998  gil_function_requires<Regular<P> >();
999  BOOST_STATIC_ASSERT((is_same<P, typename P::value_type>::value));
1000  }
1001 };
1002 
1003 namespace detail {
1004  template <typename P1, typename P2, int K>
1005  struct channels_are_pairwise_compatible : public
1006  mpl::and_<channels_are_pairwise_compatible<P1,P2,K-1>,
1007  channels_are_compatible<typename kth_semantic_element_reference_type<P1,K>::type,
1008  typename kth_semantic_element_reference_type<P2,K>::type> > {};
1009 
1010  template <typename P1, typename P2>
1011  struct channels_are_pairwise_compatible<P1,P2,-1> : public mpl::true_ {};
1012 }
1013 
1018 template <typename P1, typename P2> // Models GIL Pixel
1020  : public mpl::and_<typename color_spaces_are_compatible<typename color_space_type<P1>::type,
1021  typename color_space_type<P2>::type>::type,
1022  detail::channels_are_pairwise_compatible<P1,P2,num_channels<P1>::value-1> > {};
1023 
1027 
1035 template <typename P1, typename P2> // precondition: P1 and P2 model PixelConcept
1037  void constraints() {
1038  BOOST_STATIC_ASSERT((pixels_are_compatible<P1,P2>::value));
1039  }
1040 };
1041 
1046 
1054 template <typename SrcP, typename DstP>
1056  void constraints() {
1057  gil_function_requires<PixelConcept<SrcP> >();
1058  gil_function_requires<MutablePixelConcept<DstP> >();
1059  color_convert(src,dst);
1060  }
1061  SrcP src;
1062  DstP dst;
1063 };
1064 
1070 
1072 
1076 
1091 template <typename D>
1093  void constraints() {
1094  gil_function_requires< boost::UnaryFunctionConcept<D,
1095  typename remove_const_and_reference<typename D::result_type>::type,
1096  typename D::argument_type> >();
1097  gil_function_requires< boost::DefaultConstructibleConcept<D> >();
1098  gil_function_requires< boost::CopyConstructibleConcept<D> >();
1099  gil_function_requires< boost::AssignableConcept<D> >();
1100 
1101  gil_function_requires<PixelConcept<typename remove_const_and_reference<typename D::result_type>::type> >();
1102 
1103  typedef typename D::const_t const_t;
1104  gil_function_requires<PixelDereferenceAdaptorConcept<const_t> >();
1105  typedef typename D::value_type value_type;
1106  gil_function_requires<PixelValueConcept<value_type> >();
1107  typedef typename D::reference reference; // == PixelConcept (if you remove const and reference)
1108  typedef typename D::const_reference const_reference; // == PixelConcept (if you remove const and reference)
1109 
1110  const bool is_mutable=D::is_mutable; ignore_unused_variable_warning(is_mutable);
1111  }
1112  D d;
1113 };
1114 
1115 template <typename P>
1116 struct PixelDereferenceAdaptorArchetype {
1117  typedef P argument_type;
1118  typedef P result_type;
1119  typedef PixelDereferenceAdaptorArchetype const_t;
1120  typedef typename remove_reference<P>::type value_type;
1121  typedef typename add_reference<P>::type reference;
1122  typedef reference const_reference;
1123  static const bool is_mutable=false;
1124  P operator()(P) const { throw; }
1125 };
1126 
1132 
1135 
1143 template <typename T>
1145  void constraints() {
1146  typedef typename dynamic_x_step_type<T>::type type;
1147  }
1148 };
1149 
1152 
1160 template <typename T>
1162  void constraints() {
1163  typedef typename dynamic_y_step_type<T>::type type;
1164  }
1165 };
1166 
1167 
1170 
1178 template <typename T>
1180  void constraints() {
1181  typedef typename transposed_type<T>::type type;
1182  }
1183 };
1184 
1188 
1191 
1207 template <typename Iterator>
1209  void constraints() {
1210  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1211  gil_function_requires<PixelBasedConcept<Iterator> >();
1212 
1213  typedef typename std::iterator_traits<Iterator>::value_type value_type;
1214  gil_function_requires<PixelValueConcept<value_type> >();
1215 
1216  typedef typename const_iterator_type<Iterator>::type const_t;
1217  static const bool is_mut = iterator_is_mutable<Iterator>::type::value; ignore_unused_variable_warning(is_mut);
1218 
1219  const_t const_it(it); ignore_unused_variable_warning(const_it); // immutable iterator must be constructible from (possibly mutable) iterator
1220 
1221  check_base(typename is_iterator_adaptor<Iterator>::type());
1222  }
1223  void check_base(mpl::false_) {}
1224  void check_base(mpl::true_) {
1225  typedef typename iterator_adaptor_get_base<Iterator>::type base_t;
1226  gil_function_requires<PixelIteratorConcept<base_t> >();
1227  }
1228 
1229  Iterator it;
1230 };
1231 
1232 namespace detail {
1233  template <typename Iterator> // Preconditions: Iterator Models PixelIteratorConcept
1234  struct PixelIteratorIsMutableConcept {
1235  void constraints() {
1236  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<Iterator> >();
1237  typedef typename remove_reference<typename std::iterator_traits<Iterator>::reference>::type ref;
1238  typedef typename element_type<ref>::type channel_t;
1239  gil_function_requires<detail::ChannelIsMutableConcept<channel_t> >();
1240  }
1241  };
1242 }
1243 
1246 
1252 template <typename Iterator>
1254  void constraints() {
1255  gil_function_requires<PixelIteratorConcept<Iterator> >();
1256  gil_function_requires<detail::PixelIteratorIsMutableConcept<Iterator> >();
1257  }
1258 };
1259 
1260 namespace detail {
1261  // Iterators that can be used as the base of memory_based_step_iterator require some additional functions
1262  template <typename Iterator> // Preconditions: Iterator Models boost_concepts::RandomAccessTraversalConcept
1263  struct RandomAccessIteratorIsMemoryBasedConcept {
1264  void constraints() {
1265  std::ptrdiff_t bs=memunit_step(it); ignore_unused_variable_warning(bs);
1266  it=memunit_advanced(it,3);
1267  std::ptrdiff_t bd=memunit_distance(it,it); ignore_unused_variable_warning(bd);
1268  memunit_advance(it,3);
1269  // for performace you may also provide a customized implementation of memunit_advanced_ref
1270  }
1271  Iterator it;
1272  };
1273 }
1274 
1278 
1281 
1293 template <typename Iterator>
1295  void constraints() {
1296  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1297  gil_function_requires<detail::RandomAccessIteratorIsMemoryBasedConcept<Iterator> >();
1298  }
1299 };
1300 
1305 
1312 template <typename Iterator>
1314  void constraints() {
1315  gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1316  it.set_step(0);
1317  }
1318  Iterator it;
1319 };
1320 
1321 
1325 
1330 template <typename Iterator>
1332  void constraints() {
1333  gil_function_requires<StepIteratorConcept<Iterator> >();
1334  gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1335  }
1336 };
1337 
1341 
1344 
1369 template <typename Iterator>
1371  void constraints() {
1372  gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1373 
1374  typedef typename iterator_adaptor_get_base<Iterator>::type base_t;
1375  gil_function_requires<boost_concepts::ForwardTraversalConcept<base_t> >();
1376 
1377  BOOST_STATIC_ASSERT(is_iterator_adaptor<Iterator>::value);
1378  typedef typename iterator_adaptor_rebind<Iterator, void*>::type rebind_t;
1379 
1380  base_t base=it.base(); ignore_unused_variable_warning(base);
1381  }
1382  Iterator it;
1383 };
1384 
1387 
1392 template <typename Iterator>
1394  void constraints() {
1395  gil_function_requires<IteratorAdaptorConcept<Iterator> >();
1396  gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1397  }
1398 };
1399 
1405 
1409 
1413 
1417 
1420 
1466 template <typename Loc>
1468  void constraints() {
1469  gil_function_requires< Regular<Loc> >();
1470 
1471  typedef typename Loc::value_type value_type;
1472  typedef typename Loc::reference reference; // result of dereferencing
1473  typedef typename Loc::difference_type difference_type; // result of operator-(pixel_locator, pixel_locator)
1474  typedef typename Loc::cached_location_t cached_location_t; // type used to store relative location (to allow for more efficient repeated access)
1475  typedef typename Loc::const_t const_t; // same as this type, but over const values
1476  typedef typename Loc::point_t point_t; // same as difference_type
1477  static const std::size_t N=Loc::num_dimensions; ignore_unused_variable_warning(N);
1478 
1479  typedef typename Loc::template axis<0>::iterator first_it_type;
1480  typedef typename Loc::template axis<N-1>::iterator last_it_type;
1481  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type> >();
1482  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type> >();
1483 
1484  // point_t must be an N-dimensional point, each dimension of which must have the same type as difference_type of the corresponding iterator
1485  gil_function_requires<PointNDConcept<point_t> >();
1486  BOOST_STATIC_ASSERT(point_t::num_dimensions==N);
1487  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1488  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1489 
1490  difference_type d;
1491  loc+=d;
1492  loc-=d;
1493  loc=loc+d;
1494  loc=loc-d;
1495  reference r1=loc[d]; ignore_unused_variable_warning(r1);
1496  reference r2=*loc; ignore_unused_variable_warning(r2);
1497  cached_location_t cl=loc.cache_location(d); ignore_unused_variable_warning(cl);
1498  reference r3=loc[d]; ignore_unused_variable_warning(r3);
1499 
1500  first_it_type fi=loc.template axis_iterator<0>();
1501  fi=loc.template axis_iterator<0>(d);
1502  last_it_type li=loc.template axis_iterator<N-1>();
1503  li=loc.template axis_iterator<N-1>(d);
1504 
1505  typedef PixelDereferenceAdaptorArchetype<typename Loc::value_type> deref_t;
1506  typedef typename Loc::template add_deref<deref_t>::type dtype;
1507  //gil_function_requires<RandomAccessNDLocatorConcept<dtype> >(); // infinite recursion
1508  }
1509  Loc loc;
1510 };
1511 
1514 
1552 template <typename Loc>
1554  void constraints() {
1555  gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1556  BOOST_STATIC_ASSERT(Loc::num_dimensions==2);
1557 
1558  typedef typename dynamic_x_step_type<Loc>::type dynamic_x_step_t;
1559  typedef typename dynamic_y_step_type<Loc>::type dynamic_y_step_t;
1560  typedef typename transposed_type<Loc>::type transposed_t;
1561 
1562  typedef typename Loc::cached_location_t cached_location_t;
1563  gil_function_requires<Point2DConcept<typename Loc::point_t> >();
1564 
1565  typedef typename Loc::x_iterator x_iterator;
1566  typedef typename Loc::y_iterator y_iterator;
1567  typedef typename Loc::x_coord_t x_coord_t;
1568  typedef typename Loc::y_coord_t y_coord_t;
1569 
1570  x_coord_t xd=0; ignore_unused_variable_warning(xd);
1571  y_coord_t yd=0; ignore_unused_variable_warning(yd);
1572 
1573  typename Loc::difference_type d;
1574  typename Loc::reference r=loc(xd,yd); ignore_unused_variable_warning(r);
1575 
1576  dynamic_x_step_t loc2(dynamic_x_step_t(), yd);
1577  dynamic_x_step_t loc3(dynamic_x_step_t(), xd, yd);
1578 
1579  typedef typename dynamic_y_step_type<typename dynamic_x_step_type<transposed_t>::type>::type dynamic_xy_step_transposed_t;
1580  dynamic_xy_step_transposed_t loc4(loc, xd,yd,true);
1581 
1582  bool is_contiguous=loc.is_1d_traversable(xd); ignore_unused_variable_warning(is_contiguous);
1583  loc.y_distance_to(loc, xd);
1584 
1585  loc=loc.xy_at(d);
1586  loc=loc.xy_at(xd,yd);
1587 
1588  x_iterator xit=loc.x_at(d);
1589  xit=loc.x_at(xd,yd);
1590  xit=loc.x();
1591 
1592  y_iterator yit=loc.y_at(d);
1593  yit=loc.y_at(xd,yd);
1594  yit=loc.y();
1595 
1596  cached_location_t cl=loc.cache_location(xd,yd); ignore_unused_variable_warning(cl);
1597  }
1598  Loc loc;
1599 };
1600 
1603 
1615 template <typename Loc>
1617  void constraints() {
1618  gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1619  gil_function_requires< PixelIteratorConcept<typename Loc::x_iterator> >();
1620  gil_function_requires< PixelIteratorConcept<typename Loc::y_iterator> >();
1621  typedef typename Loc::coord_t coord_t;
1622  BOOST_STATIC_ASSERT((is_same<typename Loc::x_coord_t, typename Loc::y_coord_t>::value));
1623  }
1624  Loc loc;
1625 };
1626 
1627 namespace detail {
1628  template <typename Loc> // preconditions: Loc Models RandomAccessNDLocatorConcept
1629  struct RandomAccessNDLocatorIsMutableConcept {
1630  void constraints() {
1631  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename Loc::template axis<0>::iterator> >();
1632  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename Loc::template axis<Loc::num_dimensions-1>::iterator> >();
1633 
1634  typename Loc::difference_type d; initialize_it(d);
1635  typename Loc::value_type v;initialize_it(v);
1636  typename Loc::cached_location_t cl=loc.cache_location(d);
1637  *loc=v;
1638  loc[d]=v;
1639  loc[cl]=v;
1640  }
1641  Loc loc;
1642  };
1643 
1644  template <typename Loc> // preconditions: Loc Models RandomAccess2DLocatorConcept
1645  struct RandomAccess2DLocatorIsMutableConcept {
1646  void constraints() {
1647  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1648  typename Loc::x_coord_t xd=0; ignore_unused_variable_warning(xd);
1649  typename Loc::y_coord_t yd=0; ignore_unused_variable_warning(yd);
1650  typename Loc::value_type v; initialize_it(v);
1651  loc(xd,yd)=v;
1652  }
1653  Loc loc;
1654  };
1655 }
1656 
1659 
1666 template <typename Loc>
1668  void constraints() {
1669  gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1670  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1671  }
1672 };
1673 
1676 
1681 template <typename Loc>
1683  void constraints() {
1684  gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1685  gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1686  }
1687 };
1688 
1691 
1696 template <typename Loc>
1698  void constraints() {
1699  gil_function_requires<PixelLocatorConcept<Loc> >();
1700  gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1701  }
1702 };
1703 
1709 
1713 
1717 
1721 
1724 
1773 template <typename View>
1775  void constraints() {
1776  gil_function_requires< Regular<View> >();
1777 
1778  typedef typename View::value_type value_type;
1779  typedef typename View::reference reference; // result of dereferencing
1780  typedef typename View::difference_type difference_type; // result of operator-(1d_iterator,1d_iterator)
1781  typedef typename View::const_t const_t; // same as this type, but over const values
1782  typedef typename View::point_t point_t; // N-dimensional point
1783  typedef typename View::locator locator; // N-dimensional locator
1784  typedef typename View::iterator iterator;
1785  typedef typename View::reverse_iterator reverse_iterator;
1786  typedef typename View::size_type size_type;
1787  static const std::size_t N=View::num_dimensions;
1788 
1789  gil_function_requires<RandomAccessNDLocatorConcept<locator> >();
1790  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<iterator> >();
1791  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<reverse_iterator> >();
1792 
1793  typedef typename View::template axis<0>::iterator first_it_type;
1794  typedef typename View::template axis<N-1>::iterator last_it_type;
1795  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type> >();
1796  gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type> >();
1797 
1798 // BOOST_STATIC_ASSERT((typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1799 // BOOST_STATIC_ASSERT((typename std::iterator_traits< last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1800 
1801  // point_t must be an N-dimensional point, each dimension of which must have the same type as difference_type of the corresponding iterator
1802  gil_function_requires<PointNDConcept<point_t> >();
1803  BOOST_STATIC_ASSERT(point_t::num_dimensions==N);
1804  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<first_it_type>::difference_type, typename point_t::template axis<0>::coord_t>::value));
1805  BOOST_STATIC_ASSERT((is_same<typename std::iterator_traits<last_it_type>::difference_type, typename point_t::template axis<N-1>::coord_t>::value));
1806 
1807  point_t p;
1808  locator lc;
1809  iterator it;
1810  reverse_iterator rit;
1811  difference_type d; detail::initialize_it(d); ignore_unused_variable_warning(d);
1812 
1813  View(p,lc); // view must be constructible from a locator and a point
1814 
1815  p=view.dimensions();
1816  lc=view.pixels();
1817  size_type sz=view.size(); ignore_unused_variable_warning(sz);
1818  bool is_contiguous=view.is_1d_traversable(); ignore_unused_variable_warning(is_contiguous);
1819 
1820  it=view.begin();
1821  it=view.end();
1822  rit=view.rbegin();
1823  rit=view.rend();
1824 
1825  reference r1=view[d]; ignore_unused_variable_warning(r1); // 1D access
1826  reference r2=view(p); ignore_unused_variable_warning(r2); // 2D access
1827 
1828  // get 1-D iterator of any dimension at a given pixel location
1829  first_it_type fi=view.template axis_iterator<0>(p); ignore_unused_variable_warning(fi);
1830  last_it_type li=view.template axis_iterator<N-1>(p); ignore_unused_variable_warning(li);
1831 
1832  typedef PixelDereferenceAdaptorArchetype<typename View::value_type> deref_t;
1833  typedef typename View::template add_deref<deref_t>::type dtype;
1834  }
1835  View view;
1836 };
1837 
1840 
1877 template <typename View>
1879  void constraints() {
1880  gil_function_requires<RandomAccessNDImageViewConcept<View> >();
1881  BOOST_STATIC_ASSERT(View::num_dimensions==2);
1882 
1883  // TODO: This executes the requirements for RandomAccessNDLocatorConcept again. Fix it to improve compile time
1884  gil_function_requires<RandomAccess2DLocatorConcept<typename View::locator> >();
1885 
1886  typedef typename dynamic_x_step_type<View>::type dynamic_x_step_t;
1887  typedef typename dynamic_y_step_type<View>::type dynamic_y_step_t;
1888  typedef typename transposed_type<View>::type transposed_t;
1889 
1890  typedef typename View::x_iterator x_iterator;
1891  typedef typename View::y_iterator y_iterator;
1892  typedef typename View::x_coord_t x_coord_t;
1893  typedef typename View::y_coord_t y_coord_t;
1894  typedef typename View::xy_locator xy_locator;
1895 
1896  x_coord_t xd=0; ignore_unused_variable_warning(xd);
1897  y_coord_t yd=0; ignore_unused_variable_warning(yd);
1898  x_iterator xit;
1899  y_iterator yit;
1900  typename View::point_t d;
1901 
1902  View(xd,yd,xy_locator()); // constructible with width, height, 2d_locator
1903 
1904  xy_locator lc=view.xy_at(xd,yd);
1905  lc=view.xy_at(d);
1906 
1907  typename View::reference r=view(xd,yd); ignore_unused_variable_warning(r);
1908  xd=view.width();
1909  yd=view.height();
1910 
1911  xit=view.x_at(d);
1912  xit=view.x_at(xd,yd);
1913  xit=view.row_begin(xd);
1914  xit=view.row_end(xd);
1915 
1916  yit=view.y_at(d);
1917  yit=view.y_at(xd,yd);
1918  yit=view.col_begin(xd);
1919  yit=view.col_end(xd);
1920  }
1921  View view;
1922 };
1923 
1924 
1927 
1941 template <typename View>
1943  void constraints() {
1944  gil_function_requires<RandomAccess2DImageViewConcept<View> >();
1945 
1946  // TODO: This executes the requirements for RandomAccess2DLocatorConcept again. Fix it to improve compile time
1947  gil_function_requires<PixelLocatorConcept<typename View::xy_locator> >();
1948 
1949  BOOST_STATIC_ASSERT((is_same<typename View::x_coord_t, typename View::y_coord_t>::value));
1950 
1951  typedef typename View::coord_t coord_t; // 1D difference type (same for all dimensions)
1952  std::size_t num_chan = view.num_channels(); ignore_unused_variable_warning(num_chan);
1953  }
1954  View view;
1955 };
1956 
1957 
1958 namespace detail {
1959  template <typename View> // Preconditions: View Models RandomAccessNDImageViewConcept
1960  struct RandomAccessNDImageViewIsMutableConcept {
1961  void constraints() {
1962  gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<typename View::locator> >();
1963 
1964  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::iterator> >();
1965  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::reverse_iterator> >();
1966  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::template axis<0>::iterator> >();
1967  gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::template axis<View::num_dimensions-1>::iterator> >();
1968 
1969  typename View::difference_type diff; initialize_it(diff); ignore_unused_variable_warning(diff);
1970  typename View::point_t pt;
1971  typename View::value_type v; initialize_it(v);
1972 
1973  view[diff]=v;
1974  view(pt)=v;
1975  }
1976  View view;
1977  };
1978 
1979  template <typename View> // preconditions: View Models RandomAccessNDImageViewConcept
1980  struct RandomAccess2DImageViewIsMutableConcept {
1981  void constraints() {
1982  gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
1983  typename View::x_coord_t xd=0; ignore_unused_variable_warning(xd);
1984  typename View::y_coord_t yd=0; ignore_unused_variable_warning(yd);
1985  typename View::value_type v; initialize_it(v);
1986  view(xd,yd)=v;
1987  }
1988  View view;
1989  };
1990 
1991  template <typename View> // preconditions: View Models ImageViewConcept
1992  struct PixelImageViewIsMutableConcept {
1993  void constraints() {
1994  gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
1995  }
1996  };
1997 }
1998 
2001 
2008 template <typename View>
2010  void constraints() {
2011  gil_function_requires<RandomAccessNDImageViewConcept<View> >();
2012  gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
2013  }
2014 };
2015 
2018 
2023 template <typename View>
2025  void constraints() {
2026  gil_function_requires<RandomAccess2DImageViewConcept<View> >();
2027  gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2028  }
2029 };
2030 
2033 
2038 template <typename View>
2040  void constraints() {
2041  gil_function_requires<ImageViewConcept<View> >();
2042  gil_function_requires<detail::PixelImageViewIsMutableConcept<View> >();
2043  }
2044 };
2045 
2049 template <typename V1, typename V2> // Model ImageViewConcept
2050 struct views_are_compatible : public pixels_are_compatible<typename V1::value_type, typename V2::value_type> {};
2051 
2054 
2061 template <typename V1, typename V2>
2063  void constraints() {
2064  BOOST_STATIC_ASSERT((views_are_compatible<V1,V2>::value));
2065  }
2066 };
2067 
2068 
2074 
2075 
2078 
2099 template <typename Img>
2101  void constraints() {
2102  gil_function_requires<Regular<Img> >();
2103 
2104  typedef typename Img::view_t view_t;
2105  gil_function_requires<MutableRandomAccessNDImageViewConcept<view_t> >();
2106 
2107  typedef typename Img::const_view_t const_view_t;
2108  typedef typename Img::value_type pixel_t;
2109 
2110  typedef typename Img::point_t point_t;
2111  gil_function_requires<PointNDConcept<point_t> >();
2112 
2113  const_view_t cv = const_view(img); ignore_unused_variable_warning(cv);
2114  view_t v = view(img); ignore_unused_variable_warning(v);
2115 
2116  pixel_t fill_value;
2117  point_t pt=img.dimensions();
2118  Img im1(pt);
2119  Img im2(pt,1);
2120  Img im3(pt,fill_value,1);
2121  img.recreate(pt);
2122  img.recreate(pt,1);
2123  img.recreate(pt,fill_value,1);
2124  }
2125  Img img;
2126 };
2127 
2128 
2131 
2148 template <typename Img>
2150  void constraints() {
2151  gil_function_requires<RandomAccessNDImageConcept<Img> >();
2152  typedef typename Img::x_coord_t x_coord_t;
2153  typedef typename Img::y_coord_t y_coord_t;
2154  typedef typename Img::value_type value_t;
2155 
2156  gil_function_requires<MutableRandomAccess2DImageViewConcept<typename Img::view_t> >();
2157 
2158  x_coord_t w=img.width();
2159  y_coord_t h=img.height();
2160  value_t fill_value;
2161  Img im1(w,h);
2162  Img im2(w,h,1);
2163  Img im3(w,h,fill_value,1);
2164  img.recreate(w,h);
2165  img.recreate(w,h,1);
2166  img.recreate(w,h,fill_value,1);
2167  }
2168  Img img;
2169 };
2170 
2173 
2181 template <typename Img>
2183  void constraints() {
2184  gil_function_requires<RandomAccess2DImageConcept<Img> >();
2185  gil_function_requires<MutableImageViewConcept<typename Img::view_t> >();
2186  typedef typename Img::coord_t coord_t;
2187  BOOST_STATIC_ASSERT(num_channels<Img>::value == mpl::size<typename color_space_type<Img>::type>::value);
2188 
2189  BOOST_STATIC_ASSERT((is_same<coord_t, typename Img::x_coord_t>::value));
2190  BOOST_STATIC_ASSERT((is_same<coord_t, typename Img::y_coord_t>::value));
2191  }
2192  Img img;
2193 };
2194 
2195 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
2196 #pragma warning(pop)
2197 #endif
2198 
2199 #if defined(__GNUC__) && (__GNUC__ >= 4)
2200 #pragma GCC diagnostic pop
2201 #endif
2202 
2203 } } // namespace boost::gil
2204 
2205 #endif
Represents a unary function object that can be invoked upon dereferencing a pixel iterator...
Definition: gil_concept.hpp:1092
Concept for iterators, locators and views that can define a type just like the given iterator/locator...
Definition: gil_concept.hpp:1144
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:752
Definition: gil_concept.hpp:179
Homogeneous pixel concept that allows for changing its channels.
Definition: gil_concept.hpp:957
2-dimensional view over mutable values
Definition: gil_concept.hpp:2024
Homogeneous color base that allows for modifying its elements.
Definition: gil_concept.hpp:730
Pixel iterator that allows for changing its pixel.
Definition: gil_concept.hpp:1253
Definition: gil_concept.hpp:193
N-dimensional locator over mutable pixels.
Definition: gil_concept.hpp:1667
Definition: gil_concept.hpp:148
Concept of a random-access iterator that can be advanced in memory units (bytes or bits) ...
Definition: gil_concept.hpp:1294
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:1682
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:774
Iterator adaptor is a forward iterator adapting another forward iterator.
Definition: gil_concept.hpp:1370
Concept for pixel compatibility Pixels are compatible if their channels and color space types are com...
Definition: gil_concept.hpp:1036
N-dimensional view over mutable values.
Definition: gil_concept.hpp:2009
Pixel concept that is a Regular type.
Definition: gil_concept.hpp:978
channel_traits< DstChannel >::value_type channel_convert(const SrcChannel &src)
Converting from one channel type to another.
Definition: channel_algorithm.hpp:420
N-dimensional container of values.
Definition: gil_concept.hpp:2100
Step iterator that allows for modifying its current value.
Definition: gil_concept.hpp:1331
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:1161
Definition: gil_concept.hpp:208
A channel is convertible to another one if the channel_convert algorithm is defined for the two chann...
Definition: gil_concept.hpp:552
2-dimensional image whose value type models PixelValueConcept
Definition: gil_concept.hpp:2182
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:615
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:447
Concept for homogeneous pixel-based GIL constructs.
Definition: gil_concept.hpp:857
Color base which allows for modifying its elements.
Definition: gil_concept.hpp:658
2-dimensional locator over immutable values
Definition: gil_concept.hpp:1553
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:829
Definition: gil_concept.hpp:133
Returns whether two views are compatible.
Definition: gil_concept.hpp:2050
A channel that supports default construction.
Definition: gil_concept.hpp:501
Concept for locators and views that can define a type just like the given locator or view...
Definition: gil_concept.hpp:1179
Definition: gil_concept.hpp:244
Predicate metafunction returning whether two channels are compatibleChannels are considered compatibl...
Definition: gil_concept.hpp:521
GIL's 2-dimensional locator over immutable GIL pixels.
Definition: gil_concept.hpp:1616
Channel mapping concept.
Definition: gil_concept.hpp:408
Homogeneous pixel concept that is a Regular type.
Definition: gil_concept.hpp:995
Homogeneous pixel concept.
Definition: gil_concept.hpp:937
Pixel concept that allows for changing its channels.
Definition: gil_concept.hpp:921
Color space type concept.
Definition: gil_concept.hpp:373
Definition: gil_concept.hpp:164
Pixel convertible concept.
Definition: gil_concept.hpp:1055
GIL's 2-dimensional view over mutable GIL pixels.
Definition: gil_concept.hpp:2039
Traits for channels. Contains the following members:
Definition: channel.hpp:114
Channels are compatible if their associated value types (ignoring constness and references) are the s...
Definition: gil_concept.hpp:534
2-dimensional container of values
Definition: gil_concept.hpp:2149
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:273
Color base that also has a default-constructor. Refines Regular.
Definition: gil_concept.hpp:682
2-dimensional point concept
Definition: gil_concept.hpp:310
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:1019
Iterator adaptor that is mutable.
Definition: gil_concept.hpp:1393
GIL's 2-dimensional view over immutable GIL pixels.
Definition: gil_concept.hpp:1942
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:392
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:1878
Heterogeneous pixel value whose channel references can be constructed from the pixel bitfield and the...
Definition: gil_concept.hpp:83
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:1208
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:2062
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:1313
N-dimensional view over immutable values.
Definition: gil_concept.hpp:1774
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:486
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:702
N-dimensional locator over immutable values.
Definition: gil_concept.hpp:1467
Definition: gil_concept.hpp:225
Pixel concept - A color base whose elements are channels.
Definition: gil_concept.hpp:891
GIL's 2-dimensional locator over mutable GIL pixels.
Definition: gil_concept.hpp:1697