8 #ifndef BOOST_GIL_PLANAR_PIXEL_REFERENCE_HPP
9 #define BOOST_GIL_PLANAR_PIXEL_REFERENCE_HPP
11 #include <boost/gil/channel.hpp>
12 #include <boost/gil/color_base.hpp>
13 #include <boost/gil/concepts.hpp>
14 #include <boost/gil/pixel.hpp>
15 #include <boost/gil/planar_pixel_iterator.hpp>
17 #include <boost/mpl/range_c.hpp>
19 namespace boost {
namespace gil {
36 template <
typename ChannelReference,
typename ColorSpace>
37 struct planar_pixel_reference
38 :
public detail::homogeneous_color_base<ChannelReference,layout<ColorSpace>,mpl::size<ColorSpace>::value> {
39 typedef detail::homogeneous_color_base<ChannelReference,layout<ColorSpace>,mpl::size<ColorSpace>::value> parent_t;
42 typedef typename channel_traits<ChannelReference>::value_type channel_t;
43 typedef typename channel_traits<ChannelReference>::const_reference channel_const_reference;
45 BOOST_STATIC_CONSTANT(
bool, is_mutable = channel_traits<ChannelReference>::is_mutable);
46 typedef pixel<channel_t,layout<ColorSpace> > value_type;
47 typedef planar_pixel_reference reference;
48 typedef planar_pixel_reference<channel_const_reference,ColorSpace> const_reference;
50 planar_pixel_reference(ChannelReference v0, ChannelReference v1) : parent_t(v0,v1) {}
51 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2) : parent_t(v0,v1,v2) {}
52 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3) : parent_t(v0,v1,v2,v3) {}
53 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3, ChannelReference v4) : parent_t(v0,v1,v2,v3,v4) {}
54 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3, ChannelReference v4, ChannelReference v5) : parent_t(v0,v1,v2,v3,v4,v5) {}
56 template <
typename P> planar_pixel_reference(
const P& p) : parent_t(p) { check_compatible<P>();}
59 template <
typename ChannelV,
typename Mapping>
60 planar_pixel_reference(pixel<ChannelV,layout<ColorSpace,Mapping> >& p) : parent_t(p) { check_compatible<pixel<ChannelV,layout<ColorSpace,Mapping> > >();}
63 template <
typename ChannelPtr> planar_pixel_reference(
const planar_pixel_iterator<ChannelPtr,ColorSpace>& p, std::ptrdiff_t diff) : parent_t(p,diff) {}
65 const planar_pixel_reference& operator=(
const planar_pixel_reference& p)
const { static_copy(p,*
this);
return *
this; }
66 template <
typename P>
const planar_pixel_reference& operator=(
const P& p)
const { check_compatible<P>(); static_copy(p,*
this);
return *
this; }
75 #if BOOST_WORKAROUND(__HP_aCC, >= 61700) || BOOST_WORKAROUND(__INTEL_COMPILER, >= 1000)
76 const planar_pixel_reference& operator=(
const planar_pixel_reference& p) { static_copy(p,*
this);
return *
this; }
77 template <
typename P>
const planar_pixel_reference& operator=(
const P& p) { check_compatible<P>(); static_copy(p,*
this);
return *
this; }
80 template <
typename P>
bool operator==(
const P& p)
const { check_compatible<P>();
return static_equal(*
this,p); }
81 template <
typename P>
bool operator!=(
const P& p)
const {
return !(*
this==p); }
83 ChannelReference operator[](std::size_t i)
const {
return this->at_c_dynamic(i); }
85 const planar_pixel_reference* operator->()
const {
return this; }
87 template <
typename Pixel>
static void check_compatible() { gil_function_requires<PixelsCompatibleConcept<Pixel,planar_pixel_reference> >(); }
94 template <
typename ChannelReference,
typename ColorSpace,
int K>
95 struct kth_element_type<planar_pixel_reference<ChannelReference,ColorSpace>, K> {
96 typedef ChannelReference type;
99 template <
typename ChannelReference,
typename ColorSpace,
int K>
100 struct kth_element_reference_type<planar_pixel_reference<ChannelReference,ColorSpace>, K> {
101 typedef ChannelReference type;
104 template <
typename ChannelReference,
typename ColorSpace,
int K>
105 struct kth_element_const_reference_type<planar_pixel_reference<ChannelReference,ColorSpace>, K>
106 :
public add_reference<typename add_const<ChannelReference>::type>
117 template <
typename ChannelReference,
typename ColorSpace>
126 template <
typename ChannelReference,
typename ColorSpace>
128 typedef ColorSpace type;
133 template <
typename ChannelReference,
typename ColorSpace>
135 typedef typename layout<ColorSpace>::channel_mapping_t type;
140 template <
typename ChannelReference,
typename ColorSpace>
145 template <
typename ChannelReference,
typename ColorSpace>
147 typedef typename channel_traits<ChannelReference>::value_type type;
162 template <
typename CR,
typename CS,
typename R>
inline
164 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
169 template <
typename CR,
typename CS>
inline
171 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
176 template <
typename CR,
typename CS>
inline
178 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:32
Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept, PixelValueConcept, HomogeneousPixelBasedConcept.
Definition: metafunctions.hpp:30
Definition: color_convert.hpp:30
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:177