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 {
39 template <
typename ChannelReference,
typename ColorSpace>
40 struct planar_pixel_reference : detail::homogeneous_color_base
44 mp11::mp_size<ColorSpace>::value
47 using parent_t =detail::homogeneous_color_base
51 mp11::mp_size<ColorSpace>::value
56 using channel_t =
typename channel_traits<ChannelReference>::value_type;
57 using channel_const_reference =
typename channel_traits<ChannelReference>::const_reference;
60 static constexpr
bool is_mutable = channel_traits<ChannelReference>::is_mutable;
61 using value_type = pixel<channel_t,layout<ColorSpace>>;
62 using reference = planar_pixel_reference<ChannelReference, ColorSpace>;
63 using const_reference = planar_pixel_reference<channel_const_reference,ColorSpace>;
65 planar_pixel_reference(ChannelReference v0, ChannelReference v1)
69 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2)
70 : parent_t(v0, v1, v2)
73 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3)
74 : parent_t(v0, v1, v2, v3)
77 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3, ChannelReference v4)
78 : parent_t(v0, v1, v2, v3, v4)
81 planar_pixel_reference(ChannelReference v0, ChannelReference v1, ChannelReference v2, ChannelReference v3, ChannelReference v4, ChannelReference v5)
82 : parent_t(v0, v1, v2, v3, v4, v5)
85 planar_pixel_reference(planar_pixel_reference
const& p) : parent_t(p) {}
88 auto operator=(planar_pixel_reference
const& p)
const -> planar_pixel_reference
const&
90 static_copy(p, *
this);
94 template <
typename Pixel>
95 planar_pixel_reference(Pixel
const& p) : parent_t(p)
97 check_compatible<Pixel>();
101 template <
typename Pixel>
102 auto operator=(Pixel
const& p)
const -> planar_pixel_reference
const&
104 check_compatible<Pixel>();
105 static_copy(p, *
this);
110 template <
typename ChannelV,
typename Mapping>
111 planar_pixel_reference(pixel<ChannelV, layout<ColorSpace, Mapping>>& p)
114 check_compatible<pixel<ChannelV, layout<ColorSpace, Mapping>>>();
118 template <
typename ChannelPtr>
119 planar_pixel_reference(planar_pixel_iterator<ChannelPtr, ColorSpace>
const& p, std::ptrdiff_t diff)
130 #if BOOST_WORKAROUND(__HP_aCC, >= 61700) || BOOST_WORKAROUND(__INTEL_COMPILER, >= 1000) 131 const planar_pixel_reference& operator=(
const planar_pixel_reference& p) { static_copy(p,*
this);
return *
this; }
132 template <
typename P>
const planar_pixel_reference& operator=(
const P& p) { check_compatible<P>(); static_copy(p,*
this);
return *
this; }
135 template <
typename Pixel>
136 bool operator==(Pixel
const& p)
const 138 check_compatible<Pixel>();
139 return static_equal(*
this, p);
142 template <
typename Pixel>
143 bool operator!=(Pixel
const &p)
const {
return !(*
this == p); }
145 auto operator[](std::size_t i)
const -> ChannelReference {
return this->at_c_dynamic(i); }
146 auto operator->() const -> planar_pixel_reference const* {
return this; }
149 template <
typename Pixel>
150 static void check_compatible()
152 gil_function_requires<PixelsCompatibleConcept<Pixel, planar_pixel_reference>>();
160 template <
typename ChannelReference,
typename ColorSpace,
int K>
161 struct kth_element_type<planar_pixel_reference<ChannelReference, ColorSpace>, K>
163 using type = ChannelReference;
166 template <
typename ChannelReference,
typename ColorSpace,
int K>
167 struct kth_element_reference_type
169 planar_pixel_reference<ChannelReference, ColorSpace>,
173 using type = ChannelReference;
176 template <
typename ChannelReference,
typename ColorSpace,
int K>
177 struct kth_element_const_reference_type
179 planar_pixel_reference<ChannelReference, ColorSpace>,
182 : std::add_lvalue_reference<typename std::add_const<ChannelReference>::type>
193 template <
typename ChannelReference,
typename ColorSpace>
204 template <
typename ChannelReference,
typename ColorSpace>
206 using type = ColorSpace;
211 template <
typename ChannelReference,
typename ColorSpace>
213 using type =
typename layout<ColorSpace>::channel_mapping_t;
218 template <
typename ChannelReference,
typename ColorSpace>
225 template <
typename ChannelReference,
typename ColorSpace>
227 using type =
typename channel_traits<ChannelReference>::value_type;
242 template <
typename CR,
typename CS,
typename R>
inline 244 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
249 template <
typename CR,
typename CS>
inline 251 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
256 template <
typename CR,
typename CS>
inline 258 boost::gil::swap_proxy<typename boost::gil::planar_pixel_reference<CR,CS>::value_type>(x,y);
A reference proxy to a planar pixel.
Definition: metafunctions.hpp:25
Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept,...
Definition: metafunctions.hpp:23
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:257