13 #ifndef BOOST_GIL_CONCEPT_HPP
14 #define BOOST_GIL_CONCEPT_HPP
27 #include <boost/concept_check.hpp>
28 #include <boost/iterator/iterator_concepts.hpp>
29 #include <boost/mpl/and.hpp>
30 #include <boost/mpl/size.hpp>
31 #include <boost/type_traits.hpp>
32 #include <boost/utility/enable_if.hpp>
36 namespace boost {
namespace gil {
38 #if defined(__GNUC__) && (__GNUC__ >= 4)
39 #pragma GCC diagnostic push
40 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
43 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
45 #pragma warning(disable:4510) //default constructor could not be generated
46 #pragma warning(disable:4512) //assignment operator could not be generated
47 #pragma warning(disable:4610) //can never be instantiated - user defined constructor required
50 template <
typename T>
struct channel_traits;
51 template <
typename P>
struct is_pixel;
52 template <
typename dstT,
typename srcT>
53 typename channel_traits<dstT>::value_type
channel_convert(
const srcT& val);
55 template <std::
size_t K,
typename T>
const T& axis_value(
const point2<T>& p);
56 template <std::
size_t K,
typename T> T& axis_value(
point2<T>& p);
57 template <
typename ColorBase,
int K>
struct kth_element_type;
58 template <
typename ColorBase,
int K>
struct kth_element_reference_type;
59 template <
typename ColorBase,
int K>
struct kth_element_const_reference_type;
62 template <
typename ColorBase>
struct size;
64 template <
typename T>
struct channel_type;
65 template <
typename T>
struct color_space_type;
66 template <
typename T>
struct channel_mapping_type;
67 template <
typename T>
struct is_planar;
78 namespace detail {
template <
typename Element,
typename Layout,
int K>
struct homogeneous_color_base; }
79 template <
int K,
typename E,
typename L,
int N>
80 typename add_reference<E>::type at_c( detail::homogeneous_color_base<E,L,N>& p);
82 template <
int K,
typename E,
typename L,
int N>
83 typename add_reference<typename add_const<E>::type>::type at_c(
const detail::homogeneous_color_base<E,L,N>& p);
86 template <
int K,
typename P,
typename C,
typename L>
87 typename kth_element_reference_type<packed_pixel<P,C,L>, K>::type
90 template <
int K,
typename P,
typename C,
typename L>
91 typename kth_element_const_reference_type<packed_pixel<P,C,L>,K>::type
96 template <
int K,
typename B,
typename C,
typename L,
bool M>
inline
97 typename kth_element_reference_type<bit_aligned_pixel_reference<B,C,L,M>, K>::type
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);
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;
111 template <
typename T>
112 void initialize_it(T&) {}
115 template <
typename T>
116 struct remove_const_and_reference :
public remove_const<typename remove_reference<T>::type> {};
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>(); }
122 #define GIL_CLASS_REQUIRE(T,NS,C)
123 template <
typename C>
void gil_function_requires() {}
134 template <
typename T>
137 function_requires<boost::DefaultConstructibleConcept<T> >();
149 template <
typename T>
152 function_requires<boost::CopyConstructibleConcept<T> >();
165 template <
typename T>
168 function_requires<boost::AssignableConcept<T> >();
180 template <
typename T>
183 function_requires<boost::EqualityComparableConcept<T> >();
194 template <
typename T,
typename U>
197 BOOST_STATIC_ASSERT((boost::is_same<T,U>::value_core));
209 template <
typename T>
226 template <
typename T>
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> >();
245 template <
typename T>
248 typedef typename T::type type;
274 template <
typename P>
277 gil_function_requires< Regular<P> >();
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;
311 template <
typename P>
314 gil_function_requires< PointNDConcept<P> >();
315 BOOST_STATIC_ASSERT(P::num_dimensions == 2);
332 struct ForwardIteratorIsMutableConcept {
340 struct BidirectionalIteratorIsMutableConcept {
342 gil_function_requires< ForwardIteratorIsMutableConcept<TT> >();
349 struct RandomAccessIteratorIsMutableConcept {
351 gil_function_requires< BidirectionalIteratorIsMutableConcept<TT> >();
352 typename std::iterator_traits<TT>::difference_type n=0; ignore_unused_variable_warning(n);
374 template <
typename Cs>
381 template <
typename ColorSpace1,
typename ColorSpace2>
382 struct color_spaces_are_compatible :
public is_same<ColorSpace1,ColorSpace2> {};
393 template <
typename Cs1,
typename Cs2>
396 BOOST_STATIC_ASSERT((color_spaces_are_compatible<Cs1,Cs2>::value));
409 template <
typename CM>
448 template <
typename T>
451 gil_function_requires< boost::EqualityComparableConcept<T> >();
468 template <
typename T>
469 struct ChannelIsMutableConcept {
487 template <
typename T>
490 gil_function_requires<ChannelConcept<T> >();
491 gil_function_requires<detail::ChannelIsMutableConcept<T> >();
502 template <
typename T>
505 gil_function_requires<ChannelConcept<T> >();
506 gil_function_requires<Regular<T> >();
522 template <
typename T1,
typename T2>
524 :
public is_same<typename channel_traits<T1>::value_type, typename channel_traits<T2>::value_type> {};
535 template <
typename T1,
typename T2>
553 template <
typename SrcChannel,
typename DstChannel>
556 gil_function_requires<ChannelConcept<SrcChannel> >();
557 gil_function_requires<MutableChannelConcept<DstChannel> >();
558 dst=channel_convert<DstChannel,SrcChannel>(src); ignore_unused_variable_warning(dst);
616 template <
typename ColorBase>
619 gil_function_requires< CopyConstructible<ColorBase> >();
620 gil_function_requires< EqualityComparable<ColorBase> >();
622 typedef typename ColorBase::layout_t::color_space_t color_space_t;
623 gil_function_requires<ColorSpaceConcept<color_space_t> >();
625 typedef typename ColorBase::layout_t::channel_mapping_t channel_mapping_t;
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;
633 CR cr=gil::at_c<num_elements-1>(cb); ignore_unused_variable_warning(cr);
636 semantic_at_c<0>(cb);
659 template <
typename ColorBase>
662 gil_function_requires< ColorBaseConcept<ColorBase> >();
663 gil_function_requires< Assignable<ColorBase> >();
664 gil_function_requires< Swappable<ColorBase> >();
666 typedef typename kth_element_reference_type<ColorBase, 0>::type CR;
668 CR r=gil::at_c<0>(cb);
683 template <
typename ColorBase>
686 gil_function_requires< MutableColorBaseConcept<ColorBase> >();
687 gil_function_requires< Regular<ColorBase> >();
703 template <
typename ColorBase>
706 gil_function_requires< ColorBaseConcept<ColorBase> >();
710 typedef typename kth_element_type<ColorBase,0>::type T0;
711 typedef typename kth_element_type<ColorBase,num_elements-1>::type TN;
713 BOOST_STATIC_ASSERT((is_same<T0,TN>::value));
714 typedef typename kth_element_const_reference_type<ColorBase,0>::type CRef0;
715 CRef0 e0=dynamic_at_c(cb,0);
731 template <
typename ColorBase>
734 gil_function_requires< ColorBaseConcept<ColorBase> >();
735 gil_function_requires< HomogeneousColorBaseConcept<ColorBase> >();
736 typedef typename kth_element_reference_type<ColorBase, 0>::type R0;
737 R0 x=dynamic_at_c(cb,0);
738 dynamic_at_c(cb,0) = dynamic_at_c(cb,0);
753 template <
typename ColorBase>
756 gil_function_requires< MutableHomogeneousColorBaseConcept<ColorBase> >();
757 gil_function_requires< Regular<ColorBase> >();
775 template <
typename ColorBase1,
typename ColorBase2>
778 BOOST_STATIC_ASSERT((is_same<
typename ColorBase1::layout_t::color_space_t,
779 typename ColorBase2::layout_t::color_space_t>::value));
830 template <
typename P>
833 typedef typename color_space_type<P>::type color_space_t;
834 gil_function_requires<ColorSpaceConcept<color_space_t> >();
835 typedef typename channel_mapping_type<P>::type channel_mapping_t;
836 gil_function_requires<ChannelMappingConcept<channel_mapping_t> >();
838 static const bool planar = is_planar<P>::type::value; ignore_unused_variable_warning(planar);
843 ignore_unused_variable_warning(nc);
858 template <
typename P>
861 gil_function_requires<PixelBasedConcept<P> >();
862 typedef typename channel_type<P>::type channel_t;
863 gil_function_requires<ChannelConcept<channel_t> >();
892 template <
typename P>
895 gil_function_requires<ColorBaseConcept<P> >();
896 gil_function_requires<PixelBasedConcept<P> >();
898 BOOST_STATIC_ASSERT((is_pixel<P>::value));
899 static const bool is_mutable = P::is_mutable; ignore_unused_variable_warning(is_mutable);
901 typedef typename P::value_type value_type;
904 typedef typename P::reference reference;
905 gil_function_requires<PixelConcept<typename remove_const_and_reference<reference>::type> >();
907 typedef typename P::const_reference const_reference;
908 gil_function_requires<PixelConcept<typename remove_const_and_reference<const_reference>::type> >();
922 template <
typename P>
925 gil_function_requires<PixelConcept<P> >();
926 BOOST_STATIC_ASSERT(P::is_mutable);
938 template <
typename P>
941 gil_function_requires<PixelConcept<P> >();
942 gil_function_requires<HomogeneousColorBaseConcept<P> >();
943 gil_function_requires<HomogeneousPixelBasedConcept<P> >();
958 template <
typename P>
961 gil_function_requires<HomogeneousPixelConcept<P> >();
962 gil_function_requires<MutableHomogeneousColorBaseConcept<P> >();
979 template <
typename P>
982 gil_function_requires<PixelConcept<P> >();
983 gil_function_requires<Regular<P> >();
996 template <
typename P>
999 gil_function_requires<HomogeneousPixelConcept<P> >();
1000 gil_function_requires<Regular<P> >();
1001 BOOST_STATIC_ASSERT((is_same<P, typename P::value_type>::value));
1006 template <
typename P1,
typename P2,
int K>
1007 struct channels_are_pairwise_compatible :
public
1008 mpl::and_<channels_are_pairwise_compatible<P1,P2,K-1>,
1009 channels_are_compatible<typename kth_semantic_element_reference_type<P1,K>::type,
1010 typename kth_semantic_element_reference_type<P2,K>::type> > {};
1012 template <
typename P1,
typename P2>
1013 struct channels_are_pairwise_compatible<P1,P2,-1> :
public mpl::true_ {};
1020 template <
typename P1,
typename P2>
1022 :
public mpl::and_<typename color_spaces_are_compatible<typename color_space_type<P1>::type,
1023 typename color_space_type<P2>::type>::type,
1024 detail::channels_are_pairwise_compatible<P1,P2,num_channels<P1>::value-1> > {};
1037 template <
typename P1,
typename P2>
1039 void constraints() {
1056 template <
typename SrcP,
typename DstP>
1058 void constraints() {
1059 gil_function_requires<PixelConcept<SrcP> >();
1060 gil_function_requires<MutablePixelConcept<DstP> >();
1093 template <
typename D>
1095 void constraints() {
1096 gil_function_requires< boost::UnaryFunctionConcept<D,
1097 typename remove_const_and_reference<typename D::result_type>::type,
1098 typename D::argument_type> >();
1099 gil_function_requires< boost::DefaultConstructibleConcept<D> >();
1100 gil_function_requires< boost::CopyConstructibleConcept<D> >();
1101 gil_function_requires< boost::AssignableConcept<D> >();
1103 gil_function_requires<PixelConcept<typename remove_const_and_reference<typename D::result_type>::type> >();
1105 typedef typename D::const_t const_t;
1106 gil_function_requires<PixelDereferenceAdaptorConcept<const_t> >();
1107 typedef typename D::value_type value_type;
1108 gil_function_requires<PixelValueConcept<value_type> >();
1109 typedef typename D::reference reference;
1110 typedef typename D::const_reference const_reference;
1112 const bool is_mutable=D::is_mutable; ignore_unused_variable_warning(is_mutable);
1117 template <
typename P>
1118 struct PixelDereferenceAdaptorArchetype {
1119 typedef P argument_type;
1120 typedef P result_type;
1121 typedef PixelDereferenceAdaptorArchetype const_t;
1122 typedef typename remove_reference<P>::type value_type;
1123 typedef typename add_reference<P>::type reference;
1124 typedef reference const_reference;
1125 static const bool is_mutable=
false;
1126 P operator()(P)
const {
throw; }
1145 template <
typename T>
1147 void constraints() {
1148 typedef typename dynamic_x_step_type<T>::type type;
1162 template <
typename T>
1164 void constraints() {
1165 typedef typename dynamic_y_step_type<T>::type type;
1180 template <
typename T>
1182 void constraints() {
1183 typedef typename transposed_type<T>::type type;
1209 template <
typename Iterator>
1211 void constraints() {
1212 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1213 gil_function_requires<PixelBasedConcept<Iterator> >();
1215 typedef typename std::iterator_traits<Iterator>::value_type value_type;
1216 gil_function_requires<PixelValueConcept<value_type> >();
1221 const_t const_it(it); ignore_unused_variable_warning(const_it);
1225 void check_base(mpl::false_) {}
1226 void check_base(mpl::true_) {
1228 gil_function_requires<PixelIteratorConcept<base_t> >();
1235 template <
typename Iterator>
1236 struct PixelIteratorIsMutableConcept {
1237 void constraints() {
1238 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<Iterator> >();
1239 typedef typename remove_reference<typename std::iterator_traits<Iterator>::reference>::type ref;
1241 gil_function_requires<detail::ChannelIsMutableConcept<channel_t> >();
1254 template <
typename Iterator>
1256 void constraints() {
1257 gil_function_requires<PixelIteratorConcept<Iterator> >();
1258 gil_function_requires<detail::PixelIteratorIsMutableConcept<Iterator> >();
1264 template <
typename Iterator>
1265 struct RandomAccessIteratorIsMemoryBasedConcept {
1266 void constraints() {
1267 std::ptrdiff_t bs=memunit_step(it); ignore_unused_variable_warning(bs);
1268 it=memunit_advanced(it,3);
1269 std::ptrdiff_t bd=memunit_distance(it,it); ignore_unused_variable_warning(bd);
1270 memunit_advance(it,3);
1295 template <
typename Iterator>
1297 void constraints() {
1298 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1299 gil_function_requires<detail::RandomAccessIteratorIsMemoryBasedConcept<Iterator> >();
1314 template <
typename Iterator>
1316 void constraints() {
1317 gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1332 template <
typename Iterator>
1334 void constraints() {
1335 gil_function_requires<StepIteratorConcept<Iterator> >();
1336 gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1371 template <
typename Iterator>
1373 void constraints() {
1374 gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1377 gil_function_requires<boost_concepts::ForwardTraversalConcept<base_t> >();
1382 base_t base=it.base(); ignore_unused_variable_warning(base);
1394 template <
typename Iterator>
1396 void constraints() {
1397 gil_function_requires<IteratorAdaptorConcept<Iterator> >();
1398 gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1468 template <
typename Loc>
1470 void constraints() {
1471 gil_function_requires< Regular<Loc> >();
1473 typedef typename Loc::value_type value_type;
1474 typedef typename Loc::reference reference;
1475 typedef typename Loc::difference_type difference_type;
1476 typedef typename Loc::cached_location_t cached_location_t;
1477 typedef typename Loc::const_t const_t;
1478 typedef typename Loc::point_t point_t;
1479 static const std::size_t N=Loc::num_dimensions; ignore_unused_variable_warning(N);
1481 typedef typename Loc::template axis<0>::iterator first_it_type;
1482 typedef typename Loc::template axis<N-1>::iterator last_it_type;
1483 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type> >();
1484 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type> >();
1487 gil_function_requires<PointNDConcept<point_t> >();
1488 BOOST_STATIC_ASSERT(point_t::num_dimensions==N);
1489 BOOST_STATIC_ASSERT((is_same<
typename std::iterator_traits<first_it_type>::difference_type,
typename point_t::template axis<0>::coord_t>::value));
1490 BOOST_STATIC_ASSERT((is_same<
typename std::iterator_traits<last_it_type>::difference_type,
typename point_t::template axis<N-1>::coord_t>::value));
1497 reference r1=loc[d]; ignore_unused_variable_warning(r1);
1498 reference r2=*loc; ignore_unused_variable_warning(r2);
1499 cached_location_t cl=loc.cache_location(d); ignore_unused_variable_warning(cl);
1500 reference r3=loc[d]; ignore_unused_variable_warning(r3);
1502 first_it_type fi=loc.template axis_iterator<0>();
1503 fi=loc.template axis_iterator<0>(d);
1504 last_it_type li=loc.template axis_iterator<N-1>();
1505 li=loc.template axis_iterator<N-1>(d);
1507 typedef PixelDereferenceAdaptorArchetype<typename Loc::value_type> deref_t;
1508 typedef typename Loc::template add_deref<deref_t>::type dtype;
1554 template <
typename Loc>
1556 void constraints() {
1557 gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1558 BOOST_STATIC_ASSERT(Loc::num_dimensions==2);
1560 typedef typename dynamic_x_step_type<Loc>::type dynamic_x_step_t;
1561 typedef typename dynamic_y_step_type<Loc>::type dynamic_y_step_t;
1562 typedef typename transposed_type<Loc>::type transposed_t;
1564 typedef typename Loc::cached_location_t cached_location_t;
1565 gil_function_requires<Point2DConcept<typename Loc::point_t> >();
1567 typedef typename Loc::x_iterator x_iterator;
1568 typedef typename Loc::y_iterator y_iterator;
1569 typedef typename Loc::x_coord_t x_coord_t;
1570 typedef typename Loc::y_coord_t y_coord_t;
1572 x_coord_t xd=0; ignore_unused_variable_warning(xd);
1573 y_coord_t yd=0; ignore_unused_variable_warning(yd);
1575 typename Loc::difference_type d;
1576 typename Loc::reference r=loc(xd,yd); ignore_unused_variable_warning(r);
1578 dynamic_x_step_t loc2(dynamic_x_step_t(), yd);
1579 dynamic_x_step_t loc3(dynamic_x_step_t(), xd, yd);
1581 typedef typename dynamic_y_step_type<typename dynamic_x_step_type<transposed_t>::type>::type dynamic_xy_step_transposed_t;
1582 dynamic_xy_step_transposed_t loc4(loc, xd,yd,
true);
1584 bool is_contiguous=loc.is_1d_traversable(xd); ignore_unused_variable_warning(is_contiguous);
1585 loc.y_distance_to(loc, xd);
1588 loc=loc.xy_at(xd,yd);
1590 x_iterator xit=loc.x_at(d);
1591 xit=loc.x_at(xd,yd);
1594 y_iterator yit=loc.y_at(d);
1595 yit=loc.y_at(xd,yd);
1598 cached_location_t cl=loc.cache_location(xd,yd); ignore_unused_variable_warning(cl);
1617 template <
typename Loc>
1619 void constraints() {
1620 gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1621 gil_function_requires< PixelIteratorConcept<typename Loc::x_iterator> >();
1622 gil_function_requires< PixelIteratorConcept<typename Loc::y_iterator> >();
1623 typedef typename Loc::coord_t coord_t;
1624 BOOST_STATIC_ASSERT((is_same<typename Loc::x_coord_t, typename Loc::y_coord_t>::value));
1630 template <
typename Loc>
1631 struct RandomAccessNDLocatorIsMutableConcept {
1632 void constraints() {
1633 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename Loc::template axis<0>::iterator> >();
1634 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<
typename Loc::template axis<Loc::num_dimensions-1>::iterator> >();
1636 typename Loc::difference_type d; initialize_it(d);
1637 typename Loc::value_type v;initialize_it(v);
1638 typename Loc::cached_location_t cl=loc.cache_location(d);
1646 template <
typename Loc>
1647 struct RandomAccess2DLocatorIsMutableConcept {
1648 void constraints() {
1649 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1650 typename Loc::x_coord_t xd=0; ignore_unused_variable_warning(xd);
1651 typename Loc::y_coord_t yd=0; ignore_unused_variable_warning(yd);
1652 typename Loc::value_type v; initialize_it(v);
1668 template <
typename Loc>
1670 void constraints() {
1671 gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1672 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1683 template <
typename Loc>
1685 void constraints() {
1686 gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1687 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1698 template <
typename Loc>
1700 void constraints() {
1701 gil_function_requires<PixelLocatorConcept<Loc> >();
1702 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1775 template <
typename View>
1777 void constraints() {
1778 gil_function_requires< Regular<View> >();
1780 typedef typename View::value_type value_type;
1781 typedef typename View::reference reference;
1782 typedef typename View::difference_type difference_type;
1783 typedef typename View::const_t const_t;
1784 typedef typename View::point_t point_t;
1785 typedef typename View::locator locator;
1786 typedef typename View::iterator iterator;
1787 typedef typename View::reverse_iterator reverse_iterator;
1788 typedef typename View::size_type size_type;
1789 static const std::size_t N=View::num_dimensions;
1791 gil_function_requires<RandomAccessNDLocatorConcept<locator> >();
1792 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<iterator> >();
1793 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<reverse_iterator> >();
1795 typedef typename View::template axis<0>::iterator first_it_type;
1796 typedef typename View::template axis<N-1>::iterator last_it_type;
1797 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type> >();
1798 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type> >();
1804 gil_function_requires<PointNDConcept<point_t> >();
1805 BOOST_STATIC_ASSERT(point_t::num_dimensions==N);
1806 BOOST_STATIC_ASSERT((is_same<
typename std::iterator_traits<first_it_type>::difference_type,
typename point_t::template axis<0>::coord_t>::value));
1807 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 reverse_iterator rit;
1813 difference_type d; detail::initialize_it(d); ignore_unused_variable_warning(d);
1817 p=view.dimensions();
1819 size_type sz=view.size(); ignore_unused_variable_warning(sz);
1820 bool is_contiguous=view.is_1d_traversable(); ignore_unused_variable_warning(is_contiguous);
1827 reference r1=view[d]; ignore_unused_variable_warning(r1);
1828 reference r2=view(p); ignore_unused_variable_warning(r2);
1831 first_it_type fi=view.template axis_iterator<0>(p); ignore_unused_variable_warning(fi);
1832 last_it_type li=view.template axis_iterator<N-1>(p); ignore_unused_variable_warning(li);
1834 typedef PixelDereferenceAdaptorArchetype<typename View::value_type> deref_t;
1835 typedef typename View::template add_deref<deref_t>::type dtype;
1879 template <
typename View>
1881 void constraints() {
1882 gil_function_requires<RandomAccessNDImageViewConcept<View> >();
1883 BOOST_STATIC_ASSERT(View::num_dimensions==2);
1886 gil_function_requires<RandomAccess2DLocatorConcept<typename View::locator> >();
1888 typedef typename dynamic_x_step_type<View>::type dynamic_x_step_t;
1889 typedef typename dynamic_y_step_type<View>::type dynamic_y_step_t;
1890 typedef typename transposed_type<View>::type transposed_t;
1892 typedef typename View::x_iterator x_iterator;
1893 typedef typename View::y_iterator y_iterator;
1894 typedef typename View::x_coord_t x_coord_t;
1895 typedef typename View::y_coord_t y_coord_t;
1896 typedef typename View::xy_locator xy_locator;
1898 x_coord_t xd=0; ignore_unused_variable_warning(xd);
1899 y_coord_t yd=0; ignore_unused_variable_warning(yd);
1902 typename View::point_t d;
1904 View(xd,yd,xy_locator());
1906 xy_locator lc=view.xy_at(xd,yd);
1909 typename View::reference r=view(xd,yd); ignore_unused_variable_warning(r);
1914 xit=view.x_at(xd,yd);
1915 xit=view.row_begin(xd);
1916 xit=view.row_end(xd);
1919 yit=view.y_at(xd,yd);
1920 yit=view.col_begin(xd);
1921 yit=view.col_end(xd);
1943 template <
typename View>
1945 void constraints() {
1946 gil_function_requires<RandomAccess2DImageViewConcept<View> >();
1949 gil_function_requires<PixelLocatorConcept<typename View::xy_locator> >();
1951 BOOST_STATIC_ASSERT((is_same<typename View::x_coord_t, typename View::y_coord_t>::value));
1953 typedef typename View::coord_t coord_t;
1954 std::size_t num_chan = view.num_channels(); ignore_unused_variable_warning(num_chan);
1961 template <
typename View>
1962 struct RandomAccessNDImageViewIsMutableConcept {
1963 void constraints() {
1964 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<typename View::locator> >();
1966 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::iterator> >();
1967 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::reverse_iterator> >();
1968 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::template axis<0>::iterator> >();
1969 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<
typename View::template axis<View::num_dimensions-1>::iterator> >();
1971 typename View::difference_type diff; initialize_it(diff); ignore_unused_variable_warning(diff);
1972 typename View::point_t pt;
1973 typename View::value_type v; initialize_it(v);
1981 template <
typename View>
1982 struct RandomAccess2DImageViewIsMutableConcept {
1983 void constraints() {
1984 gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
1985 typename View::x_coord_t xd=0; ignore_unused_variable_warning(xd);
1986 typename View::y_coord_t yd=0; ignore_unused_variable_warning(yd);
1987 typename View::value_type v; initialize_it(v);
1993 template <
typename View>
1994 struct PixelImageViewIsMutableConcept {
1995 void constraints() {
1996 gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2010 template <
typename View>
2012 void constraints() {
2013 gil_function_requires<RandomAccessNDImageViewConcept<View> >();
2014 gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
2025 template <
typename View>
2027 void constraints() {
2028 gil_function_requires<RandomAccess2DImageViewConcept<View> >();
2029 gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2040 template <
typename View>
2042 void constraints() {
2043 gil_function_requires<ImageViewConcept<View> >();
2044 gil_function_requires<detail::PixelImageViewIsMutableConcept<View> >();
2051 template <
typename V1,
typename V2>
2063 template <
typename V1,
typename V2>
2065 void constraints() {
2101 template <
typename Img>
2103 void constraints() {
2104 gil_function_requires<Regular<Img> >();
2106 typedef typename Img::view_t view_t;
2107 gil_function_requires<MutableRandomAccessNDImageViewConcept<view_t> >();
2109 typedef typename Img::const_view_t const_view_t;
2110 typedef typename Img::value_type pixel_t;
2112 typedef typename Img::point_t point_t;
2113 gil_function_requires<PointNDConcept<point_t> >();
2115 const_view_t cv =
const_view(img); ignore_unused_variable_warning(cv);
2116 view_t v =
view(img); ignore_unused_variable_warning(v);
2119 point_t pt=img.dimensions();
2122 Img im3(pt,fill_value,1);
2125 img.recreate(pt,fill_value,1);
2150 template <
typename Img>
2152 void constraints() {
2153 gil_function_requires<RandomAccessNDImageConcept<Img> >();
2154 typedef typename Img::x_coord_t x_coord_t;
2155 typedef typename Img::y_coord_t y_coord_t;
2156 typedef typename Img::value_type value_t;
2158 gil_function_requires<MutableRandomAccess2DImageViewConcept<typename Img::view_t> >();
2160 x_coord_t w=img.width();
2161 y_coord_t h=img.height();
2165 Img im3(w,h,fill_value,1);
2167 img.recreate(w,h,1);
2168 img.recreate(w,h,fill_value,1);
2183 template <
typename Img>
2185 void constraints() {
2186 gil_function_requires<RandomAccess2DImageConcept<Img> >();
2187 gil_function_requires<MutableImageViewConcept<typename Img::view_t> >();
2188 typedef typename Img::coord_t coord_t;
2191 BOOST_STATIC_ASSERT((is_same<coord_t, typename Img::x_coord_t>::value));
2192 BOOST_STATIC_ASSERT((is_same<coord_t, typename Img::y_coord_t>::value));
2197 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
2198 #pragma warning(pop)
2201 #if defined(__GNUC__) && (__GNUC__ >= 4)
2202 #pragma GCC diagnostic pop
Represents a unary function object that can be invoked upon dereferencing a pixel iterator...
Definition: concept.hpp:1094
Concept for iterators, locators and views that can define a type just like the given iterator/locator...
Definition: concept.hpp:1146
metafunction predicate determining whether the given iterator is a plain one or an adaptor over anoth...
Definition: concept.hpp:72
Homogeneous color base that also has a default constructor. Refines Regular.
Definition: concept.hpp:754
Definition: concept.hpp:181
Homogeneous pixel concept that allows for changing its channels.
Definition: concept.hpp:959
2-dimensional view over mutable values
Definition: concept.hpp:2026
Homogeneous color base that allows for modifying its elements.
Definition: concept.hpp:732
Pixel iterator that allows for changing its pixel.
Definition: concept.hpp:1255
Definition: concept.hpp:195
N-dimensional locator over mutable pixels.
Definition: concept.hpp:1669
Definition: concept.hpp:150
Concept of a random-access iterator that can be advanced in memory units (bytes or bits) ...
Definition: concept.hpp:1296
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:121
2-dimensional locator over mutable pixels
Definition: concept.hpp:1684
returns the base iterator for a given iterator adaptor. Provide an specialization when introducing ne...
Definition: concept.hpp:74
Two color bases are compatible if they have the same color space and their elements are compatible...
Definition: concept.hpp:776
Iterator adaptor is a forward iterator adapting another forward iterator.
Definition: concept.hpp:1372
Concept for pixel compatibility Pixels are compatible if their channels and color space types are com...
Definition: concept.hpp:1038
N-dimensional view over mutable values.
Definition: concept.hpp:2011
Pixel concept that is a Regular type.
Definition: concept.hpp:980
channel_traits< DstChannel >::value_type channel_convert(const SrcChannel &src)
Converting from one channel type to another.
Definition: channel_algorithm.hpp:419
N-dimensional container of values.
Definition: concept.hpp:2102
Step iterator that allows for modifying its current value.
Definition: concept.hpp:1333
Specifies the element type of a homogeneous color base.
Definition: color_base_algorithm.hpp:215
Concept for locators and views that can define a type just like the given locator or view...
Definition: concept.hpp:1163
Definition: concept.hpp:210
A channel is convertible to another one if the channel_convert algorithm is defined for the two chann...
Definition: concept.hpp:554
2-dimensional image whose value type models PixelValueConcept
Definition: concept.hpp:2184
Heterogeneous pixel reference corresponding to non-byte-aligned bit range. Models ColorBaseConcept...
Definition: bit_aligned_pixel_reference.hpp:124
A color base is a container of color elements (such as channels, channel references or channel pointe...
Definition: 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: concept.hpp:449
Concept for homogeneous pixel-based GIL constructs.
Definition: concept.hpp:859
Color base which allows for modifying its elements.
Definition: concept.hpp:660
2-dimensional locator over immutable values
Definition: concept.hpp:1555
Specifies the return type of the mutable semantic_at_c<K>(color_base);.
Definition: color_base_algorithm.hpp:103
Concept for all pixel-based GIL constructs, such as pixels, iterators, locators, views and images who...
Definition: concept.hpp:831
Definition: concept.hpp:135
Returns whether two views are compatible.
Definition: concept.hpp:2052
A channel that supports default construction.
Definition: concept.hpp:503
Concept for locators and views that can define a type just like the given locator or view...
Definition: concept.hpp:1181
Predicate metafunction returning whether two channels are compatibleChannels are considered compatibl...
Definition: concept.hpp:523
GIL's 2-dimensional locator over immutable GIL pixels.
Definition: concept.hpp:1618
Channel mapping concept.
Definition: concept.hpp:410
Homogeneous pixel concept that is a Regular type.
Definition: concept.hpp:997
Homogeneous pixel concept.
Definition: concept.hpp:939
Pixel concept that allows for changing its channels.
Definition: concept.hpp:923
Color space type concept.
Definition: concept.hpp:375
Definition: concept.hpp:166
Pixel convertible concept.
Definition: concept.hpp:1057
GIL's 2-dimensional view over mutable GIL pixels.
Definition: concept.hpp:2041
Traits for channels. Contains the following members:
Definition: channel.hpp:112
Channels are compatible if their associated value types (ignoring constness and references) are the s...
Definition: concept.hpp:536
2-dimensional container of values
Definition: concept.hpp:2151
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:309
N-dimensional point concept.
Definition: concept.hpp:275
Color base that also has a default-constructor. Refines Regular.
Definition: concept.hpp:684
2-dimensional point concept
Definition: concept.hpp:312
Changes the base iterator of an iterator adaptor. Provide an specialization when introducing new iter...
Definition: concept.hpp:73
Returns whether two pixels are compatible.
Definition: concept.hpp:1021
Iterator adaptor that is mutable.
Definition: concept.hpp:1395
GIL's 2-dimensional view over immutable GIL pixels.
Definition: concept.hpp:1944
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:479
Two color spaces are compatible if they are the same.
Definition: concept.hpp:394
Metafunction predicate returning whether the given iterator allows for changing its values...
Definition: concept.hpp:71
2-dimensional view over immutable values
Definition: concept.hpp:1880
Heterogeneous pixel value whose channel references can be constructed from the pixel bitfield and the...
Definition: concept.hpp:85
Returns an MPL integral type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:60
2D point both axes of which have the same dimension typeModels: Point2DConcept
Definition: concept.hpp:54
An STL random access traversal iterator over a model of PixelConcept.
Definition: concept.hpp:1210
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:483
Views are compatible if they have the same color spaces and compatible channel values. Constness and layout are not important for compatibility.
Definition: concept.hpp:2064
Returns the type of an iterator just like the input iterator, except operating over immutable values...
Definition: concept.hpp:70
Step iterator concept.
Definition: concept.hpp:1315
N-dimensional view over immutable values.
Definition: concept.hpp:1776
Returns the number of channels of a pixel-based GIL construct.
Definition: concept.hpp:68
A channel that allows for modifying its value.
Definition: concept.hpp:488
Specifies the return type of the constant semantic_at_c<K>(color_base);.
Definition: color_base_algorithm.hpp:111
Color base whose elements all have the same type.
Definition: concept.hpp:704
N-dimensional locator over immutable values.
Definition: concept.hpp:1469
Definition: concept.hpp:227
Pixel concept - A color base whose elements are channels.
Definition: concept.hpp:893
GIL's 2-dimensional locator over mutable GIL pixels.
Definition: concept.hpp:1699