8 #ifndef BOOST_GIL_CONCEPTS_COLOR_BASE_HPP 9 #define BOOST_GIL_CONCEPTS_COLOR_BASE_HPP 11 #include <boost/gil/concepts/basic.hpp> 12 #include <boost/gil/concepts/color.hpp> 13 #include <boost/gil/concepts/concept_check.hpp> 14 #include <boost/gil/concepts/fwd.hpp> 16 #include <boost/core/ignore_unused.hpp> 17 #include <type_traits> 19 #if defined(BOOST_CLANG) 20 #pragma clang diagnostic push 21 #pragma clang diagnostic ignored "-Wunused-local-typedefs" 24 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 25 #pragma GCC diagnostic push 26 #pragma GCC diagnostic ignored "-Wunused-local-typedefs" 29 namespace boost {
namespace gil {
34 template <
typename Element,
typename Layout,
int K>
35 struct homogeneous_color_base;
39 template <
int K,
typename E,
typename L,
int N>
40 auto at_c(detail::homogeneous_color_base<E, L, N>& p)
41 ->
typename std::add_lvalue_reference<E>::type;
43 template <
int K,
typename E,
typename L,
int N>
44 auto at_c(detail::homogeneous_color_base<E, L, N>
const& p)
45 ->
typename std::add_lvalue_reference<typename std::add_const<E>::type>::type;
47 template <
typename P,
typename C,
typename L>
50 template <
int K,
typename P,
typename C,
typename L>
51 auto at_c(packed_pixel<P, C, L>& p)
52 ->
typename kth_element_reference_type<packed_pixel<P, C, L>, K>::type;
54 template <
int K,
typename P,
typename C,
typename L>
55 auto at_c(packed_pixel<P, C, L>
const& p)
56 ->
typename kth_element_const_reference_type<packed_pixel<P, C, L>, K>::type;
58 template <
typename B,
typename C,
typename L,
bool M>
59 struct bit_aligned_pixel_reference;
61 template <
int K,
typename B,
typename C,
typename L,
bool M>
62 inline auto at_c(bit_aligned_pixel_reference<B, C, L, M>
const& p)
63 ->
typename kth_element_reference_type
65 bit_aligned_pixel_reference<B, C, L, M>,
70 template <
int K,
typename ColorBase>
72 ->
typename std::enable_if
74 !std::is_const<ColorBase>::value,
75 typename kth_semantic_element_reference_type<ColorBase, K>::type
78 template <
int K,
typename ColorBase>
80 ->
typename kth_semantic_element_const_reference_type<ColorBase, K>::type;
135 template <
typename ColorBase>
140 gil_function_requires<CopyConstructible<ColorBase>>();
141 gil_function_requires<EqualityComparable<ColorBase>>();
143 using color_space_t =
typename ColorBase::layout_t::color_space_t;
144 gil_function_requires<ColorSpaceConcept<color_space_t>>();
146 using channel_mapping_t =
typename ColorBase::layout_t::channel_mapping_t;
151 using TN =
typename kth_element_type<ColorBase, num_elements - 1>::type;
152 using RN =
typename kth_element_const_reference_type<ColorBase, num_elements - 1>::type;
155 boost::ignore_unused(r);
158 semantic_at_c<0>(cb);
181 template <
typename ColorBase>
186 gil_function_requires<ColorBaseConcept<ColorBase>>();
187 gil_function_requires<Assignable<ColorBase>>();
188 gil_function_requires<Swappable<ColorBase>>();
190 using R0 =
typename kth_element_reference_type<ColorBase, 0>::type;
192 R0 r = gil::at_c<0>(cb);
193 gil::at_c<0>(cb) = r;
205 template <
typename ColorBase>
210 gil_function_requires<MutableColorBaseConcept<ColorBase>>();
211 gil_function_requires<Regular<ColorBase>>();
225 template <
typename ColorBase>
230 gil_function_requires<ColorBaseConcept<ColorBase>>();
234 using T0 =
typename kth_element_type<ColorBase, 0>::type;
235 using TN =
typename kth_element_type<ColorBase, num_elements - 1>::type;
237 static_assert(std::is_same<T0, TN>::value,
"");
239 using R0 =
typename kth_element_const_reference_type<ColorBase, 0>::type;
240 R0 r = dynamic_at_c(cb, 0);
241 boost::ignore_unused(r);
255 template <
typename ColorBase>
260 gil_function_requires<ColorBaseConcept<ColorBase>>();
261 gil_function_requires<HomogeneousColorBaseConcept<ColorBase>>();
262 using R0 =
typename kth_element_reference_type<ColorBase, 0>::type;
263 R0 r = dynamic_at_c(cb, 0);
264 boost::ignore_unused(r);
265 dynamic_at_c(cb, 0) = dynamic_at_c(cb, 0);
280 template <
typename ColorBase>
285 gil_function_requires<MutableHomogeneousColorBaseConcept<ColorBase>>();
286 gil_function_requires<Regular<ColorBase>>();
301 template <
typename ColorBase1,
typename ColorBase2>
306 static_assert(std::is_same
308 typename ColorBase1::layout_t::color_space_t,
309 typename ColorBase2::layout_t::color_space_t
320 #if defined(BOOST_CLANG) 321 #pragma clang diagnostic pop 324 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 325 #pragma GCC diagnostic pop Homogeneous color base that also has a default constructor. Refines Regular.
Definition: concepts/color_base.hpp:281
Homogeneous color base that allows for modifying its elements.
Definition: concepts/color_base.hpp:256
Two color bases are compatible if they have the same color space and their elements are compatible,...
Definition: concepts/color_base.hpp:302
A color base is a container of color elements (such as channels, channel references or channel pointe...
Definition: concepts/color_base.hpp:136
Color base which allows for modifying its elements.
Definition: concepts/color_base.hpp:182
auto semantic_at_c(ColorBase &p) -> typename std::enable_if< !std::is_const< ColorBase >::value, typename kth_semantic_element_reference_type< ColorBase, K >::type >::type
A mutable accessor to the K-th semantic element of a color base.
Definition: color_base_algorithm.hpp:119
auto at_c(detail::homogeneous_color_base< E, L, N > &p) -> typename std::add_lvalue_reference< E >::type
Provides mutable access to the K-th element, in physical order.
Definition: color_base.hpp:597
Color base that also has a default-constructor. Refines Regular.
Definition: concepts/color_base.hpp:206
Returns an integral constant type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:42
Color base whose elements all have the same type.
Definition: concepts/color_base.hpp:226