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> 16 #include <boost/gil/detail/mp11.hpp> 18 #include <type_traits> 20 namespace boost {
namespace gil {
37 template <
typename ChannelReference,
typename ColorSpace>
38 struct planar_pixel_reference : detail::homogeneous_color_base
42 mp11::mp_size<ColorSpace>::value
45 using parent_t =detail::homogeneous_color_base
49 mp11::mp_size<ColorSpace>::value
54 using channel_t =
typename channel_traits<ChannelReference>::value_type;
55 using channel_const_reference =
typename channel_traits<ChannelReference>::const_reference;
58 static constexpr
bool is_mutable = channel_traits<ChannelReference>::is_mutable;
59 using value_type = pixel<channel_t,layout<ColorSpace>>;
60 using reference = planar_pixel_reference<ChannelReference, ColorSpace>;
61 using const_reference = planar_pixel_reference<channel_const_reference,ColorSpace>;
63 planar_pixel_reference(ChannelReference v0, ChannelReference v1) : parent_t(v0,v1) {}
64 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2) : parent_t(v0,v1,v2) {}
65 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3) : parent_t(v0,v1,v2,v3) {}
66 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3, ChannelReference v4) : parent_t(v0,v1,v2,v3,v4) {}
67 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3, ChannelReference v4, ChannelReference v5) : parent_t(v0,v1,v2,v3,v4,v5) {}
69 template <
typename P> planar_pixel_reference(
const P& p) : parent_t(p) { check_compatible<P>();}
72 template <
typename ChannelV,
typename Mapping>
73 planar_pixel_reference(pixel<ChannelV,layout<ColorSpace,Mapping> >& p) : parent_t(p) { check_compatible<pixel<ChannelV,layout<ColorSpace,Mapping> > >();}
76 template <
typename ChannelPtr> planar_pixel_reference(
const planar_pixel_iterator<ChannelPtr,ColorSpace>& p, std::ptrdiff_t diff) : parent_t(p,diff) {}
78 const planar_pixel_reference& operator=(
const planar_pixel_reference& p)
const { static_copy(p,*
this);
return *
this; }
79 template <
typename P>
const planar_pixel_reference& operator=(
const P& p)
const { check_compatible<P>(); static_copy(p,*
this);
return *
this; }
88 #if BOOST_WORKAROUND(__HP_aCC, >= 61700) || BOOST_WORKAROUND(__INTEL_COMPILER, >= 1000) 89 const planar_pixel_reference& operator=(
const planar_pixel_reference& p) { static_copy(p,*
this);
return *
this; }
90 template <
typename P>
const planar_pixel_reference& operator=(
const P& p) { check_compatible<P>(); static_copy(p,*
this);
return *
this; }
93 template <
typename P>
bool operator==(
const P& p)
const { check_compatible<P>();
return static_equal(*
this,p); }
94 template <
typename P>
bool operator!=(
const P& p)
const {
return !(*
this==p); }
96 ChannelReference operator[](std::size_t i)
const {
return this->at_c_dynamic(i); }
98 const planar_pixel_reference* operator->()
const {
return this; }
100 template <
typename Pixel>
static void check_compatible() { gil_function_requires<PixelsCompatibleConcept<Pixel,planar_pixel_reference> >(); }
107 template <
typename ChannelReference,
typename ColorSpace,
int K>
108 struct kth_element_type<planar_pixel_reference<ChannelReference, ColorSpace>, K>
110 using type = ChannelReference;
113 template <
typename ChannelReference,
typename ColorSpace,
int K>
114 struct kth_element_reference_type
116 planar_pixel_reference<ChannelReference, ColorSpace>,
120 using type = ChannelReference;
123 template <
typename ChannelReference,
typename ColorSpace,
int K>
124 struct kth_element_const_reference_type
126 planar_pixel_reference<ChannelReference, ColorSpace>,
129 : std::add_lvalue_reference<typename std::add_const<ChannelReference>::type>
140 template <
typename ChannelReference,
typename ColorSpace>
151 template <
typename ChannelReference,
typename ColorSpace>
153 using type = ColorSpace;
158 template <
typename ChannelReference,
typename ColorSpace>
160 using type =
typename layout<ColorSpace>::channel_mapping_t;
165 template <
typename ChannelReference,
typename ColorSpace>
172 template <
typename ChannelReference,
typename ColorSpace>
174 using type =
typename channel_traits<ChannelReference>::value_type;
189 template <
typename CR,
typename CS,
typename R>
inline 191 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
196 template <
typename CR,
typename CS>
inline 198 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
203 template <
typename CR,
typename CS>
inline 205 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:25
Definition: algorithm.hpp:30
Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept, PixelValueConcept, HomogeneousPixelBasedConcept.
Definition: metafunctions.hpp:23
Definition: algorithm.hpp:133
Definition: color_convert.hpp:31
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:204