8 #ifndef BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_ANY_IMAGE_VIEW_HPP 9 #define BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_ANY_IMAGE_VIEW_HPP 11 #include <boost/gil/dynamic_step.hpp> 12 #include <boost/gil/image.hpp> 13 #include <boost/gil/image_view.hpp> 14 #include <boost/gil/point.hpp> 15 #include <boost/gil/detail/mp11.hpp> 17 #include <boost/variant2/variant.hpp> 19 namespace boost {
namespace gil {
21 template <
typename View>
22 struct dynamic_xy_step_transposed_type;
26 template <
typename View>
27 struct get_const_t {
using type =
typename View::const_t; };
29 template <
typename Views>
30 struct views_get_const_t : mp11::mp_transform<get_const_t, Views> {};
33 struct any_type_get_num_channels
35 using result_type = int;
37 result_type operator()(
const T&)
const {
return num_channels<T>::value; }
41 struct any_type_get_dimensions
43 using result_type = point<std::ptrdiff_t>;
45 result_type operator()(
const T& v)
const {
return v.dimensions(); }
49 struct any_type_get_size
51 using result_type = std::size_t;
53 result_type operator()(
const T& v)
const {
return v.size(); }
73 template <
typename ...Views>
76 using parent_t = variant2::variant<Views...>;
79 using const_t = detail::views_get_const_t<any_image_view>;
80 using x_coord_t = std::ptrdiff_t;
81 using y_coord_t = std::ptrdiff_t;
83 using size_type = std::size_t;
88 template <
typename View>
91 template <
typename ...OtherViews>
93 : parent_t((variant2::variant<OtherViews...>
const&)
view)
98 parent_t::operator=((parent_t
const&)
view);
102 template <
typename View>
105 parent_t::operator=(
view);
109 template <
typename ...OtherViews>
112 parent_t::operator=((variant2::variant<OtherViews...>
const&)
view);
119 x_coord_t width()
const {
return dimensions().x; }
120 y_coord_t height()
const {
return dimensions().y; }
127 template <
typename ...Views>
135 template <
typename T>
139 using type = mp11::mp_transform<dynamic_step_view,
any_image_view<Views...>>;
146 template <
typename ...Views>
147 struct dynamic_y_step_type<any_image_view<Views...>>
154 template <
typename T>
158 using type = mp11::mp_transform<dynamic_step_view, any_image_view<Views...>>;
161 template <
typename ...Views>
162 struct dynamic_xy_step_type<any_image_view<Views...>>
169 template <
typename T>
170 using dynamic_step_view =
typename gil::dynamic_xy_step_type<T>::type;
173 using type = mp11::mp_transform<dynamic_step_view, any_image_view<Views...>>;
176 template <
typename ...Views>
177 struct dynamic_xy_step_transposed_type<any_image_view<Views...>>
184 template <
typename T>
185 using dynamic_step_view =
typename gil::dynamic_xy_step_type<T>::type;
188 using type = mp11::mp_transform<dynamic_step_view, any_image_view<Views...>>;
BOOST_FORCEINLINE auto apply_operation(Variant1 &&arg1, Visitor &&op)
Applies the visitor op to the variants.
Definition: apply_operation.hpp:19
Base template for types that model HasDynamicYStepTypeConcept.
Definition: dynamic_step.hpp:21
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:74
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
Returns an integral constant type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:42
Returns the number of channels of a pixel-based GIL construct.
Definition: locator.hpp:38
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17