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>
34 namespace boost {
namespace gil {
36 #if defined(__GNUC__) && (__GNUC__ >= 4)
37 #pragma GCC diagnostic push
38 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
41 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
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
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);
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;
60 template <
typename ColorBase>
struct size;
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;
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);
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);
83 #if !defined(_MSC_VER) || _MSC_VER > 1310
85 template <
int K,
typename P,
typename C,
typename L>
86 typename kth_element_reference_type<packed_pixel<P,C,L>, K>::type
89 template <
int K,
typename P,
typename C,
typename L>
90 typename kth_element_const_reference_type<packed_pixel<P,C,L>,K>::type
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
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& x) {}
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 #if !defined(_MSC_VER) || _MSC_VER > 1310
634 CR cr=gil::at_c<num_elements-1>(cb); ignore_unused_variable_warning(cr);
638 semantic_at_c<0>(cb);
661 template <
typename ColorBase>
664 gil_function_requires< ColorBaseConcept<ColorBase> >();
665 gil_function_requires< Assignable<ColorBase> >();
666 gil_function_requires< Swappable<ColorBase> >();
668 typedef typename kth_element_reference_type<ColorBase, 0>::type CR;
670 #if !defined(_MSC_VER) || _MSC_VER > 1310
671 CR r=gil::at_c<0>(cb);
687 template <
typename ColorBase>
690 gil_function_requires< MutableColorBaseConcept<ColorBase> >();
691 gil_function_requires< Regular<ColorBase> >();
707 template <
typename ColorBase>
710 gil_function_requires< ColorBaseConcept<ColorBase> >();
714 typedef typename kth_element_type<ColorBase,0>::type T0;
715 typedef typename kth_element_type<ColorBase,num_elements-1>::type TN;
717 BOOST_STATIC_ASSERT((is_same<T0,TN>::value));
718 typedef typename kth_element_const_reference_type<ColorBase,0>::type CRef0;
719 CRef0 e0=dynamic_at_c(cb,0);
735 template <
typename ColorBase>
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);
757 template <
typename ColorBase>
760 gil_function_requires< MutableHomogeneousColorBaseConcept<ColorBase> >();
761 gil_function_requires< Regular<ColorBase> >();
779 template <
typename ColorBase1,
typename ColorBase2>
782 BOOST_STATIC_ASSERT((is_same<
typename ColorBase1::layout_t::color_space_t,
783 typename ColorBase2::layout_t::color_space_t>::value));
834 template <
typename P>
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> >();
842 static const bool planar = is_planar<P>::type::value; ignore_unused_variable_warning(planar);
847 ignore_unused_variable_warning(nc);
862 template <
typename P>
865 gil_function_requires<PixelBasedConcept<P> >();
866 typedef typename channel_type<P>::type channel_t;
867 gil_function_requires<ChannelConcept<channel_t> >();
896 template <
typename P>
899 gil_function_requires<ColorBaseConcept<P> >();
900 gil_function_requires<PixelBasedConcept<P> >();
902 BOOST_STATIC_ASSERT((is_pixel<P>::value));
903 static const bool is_mutable = P::is_mutable; ignore_unused_variable_warning(is_mutable);
905 typedef typename P::value_type value_type;
908 typedef typename P::reference reference;
909 gil_function_requires<PixelConcept<typename remove_const_and_reference<reference>::type> >();
911 typedef typename P::const_reference const_reference;
912 gil_function_requires<PixelConcept<typename remove_const_and_reference<const_reference>::type> >();
926 template <
typename P>
929 gil_function_requires<PixelConcept<P> >();
930 BOOST_STATIC_ASSERT(P::is_mutable);
942 template <
typename P>
945 gil_function_requires<PixelConcept<P> >();
946 gil_function_requires<HomogeneousColorBaseConcept<P> >();
947 gil_function_requires<HomogeneousPixelBasedConcept<P> >();
962 template <
typename P>
965 gil_function_requires<HomogeneousPixelConcept<P> >();
966 gil_function_requires<MutableHomogeneousColorBaseConcept<P> >();
983 template <
typename P>
986 gil_function_requires<PixelConcept<P> >();
987 gil_function_requires<Regular<P> >();
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));
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> > {};
1016 template <
typename P1,
typename P2>
1017 struct channels_are_pairwise_compatible<P1,P2,-1> :
public mpl::true_ {};
1024 template <
typename P1,
typename P2>
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> > {};
1041 template <
typename P1,
typename P2>
1043 void constraints() {
1060 template <
typename SrcP,
typename DstP>
1062 void constraints() {
1063 gil_function_requires<PixelConcept<SrcP> >();
1064 gil_function_requires<MutablePixelConcept<DstP> >();
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> >();
1107 gil_function_requires<PixelConcept<typename remove_const_and_reference<typename D::result_type>::type> >();
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;
1114 typedef typename D::const_reference const_reference;
1116 const bool is_mutable=D::is_mutable; ignore_unused_variable_warning(is_mutable);
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; }
1149 template <
typename T>
1151 void constraints() {
1152 typedef typename dynamic_x_step_type<T>::type type;
1166 template <
typename T>
1168 void constraints() {
1169 typedef typename dynamic_y_step_type<T>::type type;
1184 template <
typename T>
1186 void constraints() {
1187 typedef typename transposed_type<T>::type type;
1213 template <
typename Iterator>
1215 void constraints() {
1216 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1217 gil_function_requires<PixelBasedConcept<Iterator> >();
1219 typedef typename std::iterator_traits<Iterator>::value_type value_type;
1220 gil_function_requires<PixelValueConcept<value_type> >();
1225 const_t const_it(it); ignore_unused_variable_warning(const_it);
1229 void check_base(mpl::false_) {}
1230 void check_base(mpl::true_) {
1232 gil_function_requires<PixelIteratorConcept<base_t> >();
1239 template <
typename Iterator>
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;
1245 gil_function_requires<detail::ChannelIsMutableConcept<channel_t> >();
1258 template <
typename Iterator>
1260 void constraints() {
1261 gil_function_requires<PixelIteratorConcept<Iterator> >();
1262 gil_function_requires<detail::PixelIteratorIsMutableConcept<Iterator> >();
1268 template <
typename Iterator>
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);
1299 template <
typename Iterator>
1301 void constraints() {
1302 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<Iterator> >();
1303 gil_function_requires<detail::RandomAccessIteratorIsMemoryBasedConcept<Iterator> >();
1318 template <
typename Iterator>
1320 void constraints() {
1321 gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1336 template <
typename Iterator>
1338 void constraints() {
1339 gil_function_requires<StepIteratorConcept<Iterator> >();
1340 gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1375 template <
typename Iterator>
1377 void constraints() {
1378 gil_function_requires<boost_concepts::ForwardTraversalConcept<Iterator> >();
1381 gil_function_requires<boost_concepts::ForwardTraversalConcept<base_t> >();
1386 base_t base=it.base(); ignore_unused_variable_warning(base);
1398 template <
typename Iterator>
1400 void constraints() {
1401 gil_function_requires<IteratorAdaptorConcept<Iterator> >();
1402 gil_function_requires<detail::ForwardIteratorIsMutableConcept<Iterator> >();
1472 template <
typename Loc>
1474 void constraints() {
1475 gil_function_requires< Regular<Loc> >();
1477 typedef typename Loc::value_type value_type;
1478 typedef typename Loc::reference reference;
1479 typedef typename Loc::difference_type difference_type;
1480 typedef typename Loc::cached_location_t cached_location_t;
1481 typedef typename Loc::const_t const_t;
1482 typedef typename Loc::point_t point_t;
1483 static const std::size_t N=Loc::num_dimensions; ignore_unused_variable_warning(N);
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> >();
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));
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);
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);
1511 typedef PixelDereferenceAdaptorArchetype<typename Loc::value_type> deref_t;
1512 typedef typename Loc::template add_deref<deref_t>::type dtype;
1558 template <
typename Loc>
1560 void constraints() {
1561 gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1562 BOOST_STATIC_ASSERT(Loc::num_dimensions==2);
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;
1568 typedef typename Loc::cached_location_t cached_location_t;
1569 gil_function_requires<Point2DConcept<typename Loc::point_t> >();
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;
1576 x_coord_t xd=0; ignore_unused_variable_warning(xd);
1577 y_coord_t yd=0; ignore_unused_variable_warning(yd);
1579 typename Loc::difference_type d;
1580 typename Loc::reference r=loc(xd,yd); ignore_unused_variable_warning(r);
1582 dynamic_x_step_t loc2(dynamic_x_step_t(), yd);
1583 dynamic_x_step_t loc3(dynamic_x_step_t(), xd, yd);
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);
1588 bool is_contiguous=loc.is_1d_traversable(xd); ignore_unused_variable_warning(is_contiguous);
1589 loc.y_distance_to(loc, xd);
1592 loc=loc.xy_at(xd,yd);
1594 x_iterator xit=loc.x_at(d);
1595 xit=loc.x_at(xd,yd);
1598 y_iterator yit=loc.y_at(d);
1599 yit=loc.y_at(xd,yd);
1602 cached_location_t cl=loc.cache_location(xd,yd); ignore_unused_variable_warning(cl);
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));
1634 template <
typename Loc>
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> >();
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);
1650 template <
typename Loc>
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);
1672 template <
typename Loc>
1674 void constraints() {
1675 gil_function_requires<RandomAccessNDLocatorConcept<Loc> >();
1676 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc> >();
1687 template <
typename Loc>
1689 void constraints() {
1690 gil_function_requires< RandomAccess2DLocatorConcept<Loc> >();
1691 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1702 template <
typename Loc>
1704 void constraints() {
1705 gil_function_requires<PixelLocatorConcept<Loc> >();
1706 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc> >();
1779 template <
typename View>
1781 void constraints() {
1782 gil_function_requires< Regular<View> >();
1784 typedef typename View::value_type value_type;
1785 typedef typename View::reference reference;
1786 typedef typename View::difference_type difference_type;
1787 typedef typename View::const_t const_t;
1788 typedef typename View::point_t point_t;
1789 typedef typename View::locator 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;
1795 gil_function_requires<RandomAccessNDLocatorConcept<locator> >();
1796 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<iterator> >();
1797 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<reverse_iterator> >();
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> >();
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));
1816 reverse_iterator rit;
1817 difference_type d; detail::initialize_it(d); ignore_unused_variable_warning(d);
1821 p=view.dimensions();
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);
1831 reference r1=view[d]; ignore_unused_variable_warning(r1);
1832 reference r2=view(p); ignore_unused_variable_warning(r2);
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);
1838 typedef PixelDereferenceAdaptorArchetype<typename View::value_type> deref_t;
1839 typedef typename View::template add_deref<deref_t>::type dtype;
1883 template <
typename View>
1885 void constraints() {
1886 gil_function_requires<RandomAccessNDImageViewConcept<View> >();
1887 BOOST_STATIC_ASSERT(View::num_dimensions==2);
1890 gil_function_requires<RandomAccess2DLocatorConcept<typename View::locator> >();
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;
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;
1902 x_coord_t xd=0; ignore_unused_variable_warning(xd);
1903 y_coord_t yd=0; ignore_unused_variable_warning(yd);
1906 typename View::point_t d;
1908 View(xd,yd,xy_locator());
1910 xy_locator lc=view.xy_at(xd,yd);
1913 typename View::reference r=view(xd,yd); ignore_unused_variable_warning(r);
1918 xit=view.x_at(xd,yd);
1919 xit=view.row_begin(xd);
1920 xit=view.row_end(xd);
1923 yit=view.y_at(xd,yd);
1924 yit=view.col_begin(xd);
1925 yit=view.col_end(xd);
1947 template <
typename View>
1949 void constraints() {
1950 gil_function_requires<RandomAccess2DImageViewConcept<View> >();
1953 gil_function_requires<PixelLocatorConcept<typename View::xy_locator> >();
1955 BOOST_STATIC_ASSERT((is_same<typename View::x_coord_t, typename View::y_coord_t>::value));
1957 typedef typename View::coord_t coord_t;
1958 std::size_t num_chan = view.num_channels(); ignore_unused_variable_warning(num_chan);
1965 template <
typename View>
1966 struct RandomAccessNDImageViewIsMutableConcept {
1967 void constraints() {
1968 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<typename View::locator> >();
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> >();
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);
1985 template <
typename View>
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);
1997 template <
typename View>
1998 struct PixelImageViewIsMutableConcept {
1999 void constraints() {
2000 gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2014 template <
typename View>
2016 void constraints() {
2017 gil_function_requires<RandomAccessNDImageViewConcept<View> >();
2018 gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View> >();
2029 template <
typename View>
2031 void constraints() {
2032 gil_function_requires<RandomAccess2DImageViewConcept<View> >();
2033 gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View> >();
2044 template <
typename View>
2046 void constraints() {
2047 gil_function_requires<ImageViewConcept<View> >();
2048 gil_function_requires<detail::PixelImageViewIsMutableConcept<View> >();
2055 template <
typename V1,
typename V2>
2067 template <
typename V1,
typename V2>
2069 void constraints() {
2105 template <
typename Img>
2107 void constraints() {
2108 gil_function_requires<Regular<Img> >();
2110 typedef typename Img::view_t view_t;
2111 gil_function_requires<MutableRandomAccessNDImageViewConcept<view_t> >();
2113 typedef typename Img::const_view_t const_view_t;
2114 typedef typename Img::value_type pixel_t;
2116 typedef typename Img::point_t point_t;
2117 gil_function_requires<PointNDConcept<point_t> >();
2119 const_view_t cv =
const_view(img); ignore_unused_variable_warning(cv);
2120 view_t v =
view(img); ignore_unused_variable_warning(v);
2123 point_t pt=img.dimensions();
2126 Img im3(pt,fill_value,1);
2129 img.recreate(pt,fill_value,1);
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;
2162 gil_function_requires<MutableRandomAccess2DImageViewConcept<typename Img::view_t> >();
2164 x_coord_t w=img.width();
2165 y_coord_t h=img.height();
2169 Img im3(w,h,fill_value,1);
2171 img.recreate(w,h,1);
2172 img.recreate(w,h,fill_value,1);
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;
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));
2201 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
2202 #pragma warning(pop)
2205 #if defined(__GNUC__) && (__GNUC__ >= 4)
2206 #pragma GCC diagnostic pop
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
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
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