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>
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;
70 : parent_t(v0, v1, v2)
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)
90 static_copy(p, *
this);
94 template <
typename Pixel>
97 check_compatible<Pixel>();
101 template <
typename Pixel>
104 check_compatible<Pixel>();
105 static_copy(p, *
this);
110 template <
typename ChannelV,
typename Mapping>
114 check_compatible<pixel<ChannelV, layout<ColorSpace, Mapping>>>();
118 template <
typename ChannelPtr>
130 #if BOOST_WORKAROUND(__HP_aCC, >= 61700) || BOOST_WORKAROUND(__INTEL_COMPILER, >= 1000)
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); }
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>
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);
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
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36
Definition: color_convert.hpp:31
Represents a color space and ordering of channels in memory.
Definition: utilities.hpp:268
Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept,...
Definition: pixel.hpp:106
An iterator over planar pixels. Models HomogeneousColorBaseConcept, PixelIteratorConcept,...
Definition: planar_pixel_iterator.hpp:58
A reference proxy to a planar pixel.
Definition: planar_pixel_reference.hpp:46