13 #ifndef GIL_PLANAR_REF_H
14 #define GIL_PLANAR_REF_H
25 #include <boost/mpl/range_c.hpp>
33 namespace boost {
namespace gil {
50 template <
typename ChannelReference,
typename ColorSpace>
51 struct planar_pixel_reference
52 :
public detail::homogeneous_color_base<ChannelReference,layout<ColorSpace>,mpl::size<ColorSpace>::value> {
53 typedef detail::homogeneous_color_base<ChannelReference,layout<ColorSpace>,mpl::size<ColorSpace>::value> parent_t;
56 typedef typename channel_traits<ChannelReference>::value_type channel_t;
57 typedef typename channel_traits<ChannelReference>::const_reference channel_const_reference;
59 BOOST_STATIC_CONSTANT(
bool, is_mutable = channel_traits<ChannelReference>::is_mutable);
60 typedef pixel<channel_t,layout<ColorSpace> > value_type;
61 typedef planar_pixel_reference reference;
62 typedef planar_pixel_reference<channel_const_reference,ColorSpace> const_reference;
64 planar_pixel_reference(ChannelReference v0, ChannelReference v1) : parent_t(v0,v1) {}
65 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2) : parent_t(v0,v1,v2) {}
66 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3) : parent_t(v0,v1,v2,v3) {}
67 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3, ChannelReference v4) : parent_t(v0,v1,v2,v3,v4) {}
68 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3, ChannelReference v4, ChannelReference v5) : parent_t(v0,v1,v2,v3,v4,v5) {}
70 template <
typename P> planar_pixel_reference(
const P& p) : parent_t(p) { check_compatible<P>();}
73 template <
typename ChannelV,
typename Mapping>
74 planar_pixel_reference(pixel<ChannelV,layout<ColorSpace,Mapping> >& p) : parent_t(p) { check_compatible<pixel<ChannelV,layout<ColorSpace,Mapping> > >();}
77 template <
typename ChannelPtr> planar_pixel_reference(
const planar_pixel_iterator<ChannelPtr,ColorSpace>& p, std::ptrdiff_t diff) : parent_t(p,diff) {}
79 const planar_pixel_reference& operator=(
const planar_pixel_reference& p)
const { static_copy(p,*
this);
return *
this; }
80 template <
typename P>
const planar_pixel_reference& operator=(
const P& p)
const { check_compatible<P>(); static_copy(p,*
this);
return *
this; }
89 #if BOOST_WORKAROUND(__HP_aCC, >= 61700) || BOOST_WORKAROUND(__INTEL_COMPILER, >= 1000)
90 const planar_pixel_reference& operator=(
const planar_pixel_reference& p) { static_copy(p,*
this);
return *
this; }
91 template <
typename P>
const planar_pixel_reference& operator=(
const P& p) { check_compatible<P>(); static_copy(p,*
this);
return *
this; }
94 template <
typename P>
bool operator==(
const P& p)
const { check_compatible<P>();
return static_equal(*
this,p); }
95 template <
typename P>
bool operator!=(
const P& p)
const {
return !(*
this==p); }
97 ChannelReference operator[](std::size_t i)
const {
return this->at_c_dynamic(i); }
99 const planar_pixel_reference* operator->()
const {
return this; }
101 template <
typename Pixel>
static void check_compatible() { gil_function_requires<PixelsCompatibleConcept<Pixel,planar_pixel_reference> >(); }
108 template <
typename ChannelReference,
typename ColorSpace,
int K>
109 struct kth_element_type<planar_pixel_reference<ChannelReference,ColorSpace>, K> {
110 typedef ChannelReference type;
113 template <
typename ChannelReference,
typename ColorSpace,
int K>
114 struct kth_element_reference_type<planar_pixel_reference<ChannelReference,ColorSpace>, K> {
115 typedef ChannelReference type;
118 template <
typename ChannelReference,
typename ColorSpace,
int K>
119 struct kth_element_const_reference_type<planar_pixel_reference<ChannelReference,ColorSpace>, K>
120 :
public add_reference<typename add_const<ChannelReference>::type>
131 template <
typename ChannelReference,
typename ColorSpace>
140 template <
typename ChannelReference,
typename ColorSpace>
142 typedef ColorSpace type;
147 template <
typename ChannelReference,
typename ColorSpace>
149 typedef typename layout<ColorSpace>::channel_mapping_t type;
154 template <
typename ChannelReference,
typename ColorSpace>
159 template <
typename ChannelReference,
typename ColorSpace>
176 template <
typename CR,
typename CS,
typename R>
inline
178 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
184 template <
typename CR,
typename CS>
inline
186 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
192 template <
typename CR,
typename CS>
inline
194 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
A reference proxy to a planar pixel. Models: HomogeneousColorBaseConcept, HomogeneousPixelConcept.
Definition: metafunctions.hpp:46
Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept, PixelValueConcept, HomogeneousPixelBasedConcept.
Definition: metafunctions.hpp:44
Concept check classes for GIL concepts.
planar pixel pointer class
pixel class and related utilities
Traits for channels. Contains the following members:
Definition: channel.hpp:114
pixel class and related utilities
void swap(const boost::gil::planar_pixel_reference< CR, CS > x, const boost::gil::planar_pixel_reference< CR, CS > y)
swap for planar_pixel_reference
Definition: planar_pixel_reference.hpp:193