9 #ifndef BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_ANY_IMAGE_VIEW_HPP
10 #define BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_ANY_IMAGE_VIEW_HPP
12 #include <boost/gil/dynamic_step.hpp>
13 #include <boost/gil/image.hpp>
14 #include <boost/gil/image_view.hpp>
15 #include <boost/gil/point.hpp>
16 #include <boost/gil/detail/mp11.hpp>
18 #include <boost/variant2/variant.hpp>
20 namespace boost {
namespace gil {
22 template <
typename View>
23 struct dynamic_xy_step_transposed_type;
27 template <
typename View>
28 using get_const_t =
typename View::const_t;
30 template <
typename Views>
31 using views_get_const_t = mp11::mp_transform<get_const_t, Views>;
34 struct any_type_get_num_channels
36 using result_type = int;
38 result_type operator()(
const T&)
const {
return num_channels<T>::value; }
42 struct any_type_get_dimensions
44 using result_type = point<std::ptrdiff_t>;
46 result_type operator()(
const T& v)
const {
return v.dimensions(); }
50 struct any_type_get_size
52 using result_type = std::size_t;
54 result_type operator()(
const T& v)
const {
return v.size(); }
74 template <
typename ...Views>
77 using parent_t = variant2::variant<Views...>;
80 using const_t = detail::views_get_const_t<any_image_view>;
81 using x_coord_t = std::ptrdiff_t;
82 using y_coord_t = std::ptrdiff_t;
84 using size_type = std::size_t;
86 using parent_t::parent_t;
90 parent_t::operator=((parent_t
const&)
view);
94 template <
typename View>
97 parent_t::operator=(
view);
101 template <
typename ...OtherViews>
104 parent_t::operator=((variant2::variant<OtherViews...>
const&)
view);
108 std::size_t
num_channels()
const {
return variant2::visit(detail::any_type_get_num_channels(), *
this); }
109 point_t dimensions()
const {
return variant2::visit(detail::any_type_get_dimensions(), *
this); }
110 size_type
size()
const {
return variant2::visit(detail::any_type_get_size(), *
this); }
111 x_coord_t width()
const {
return dimensions().x; }
112 y_coord_t height()
const {
return dimensions().y; }
119 template <
typename ...Views>
127 template <
typename T>
131 using type = mp11::mp_transform<dynamic_step_view,
any_image_view<Views...>>;
138 template <
typename ...Views>
139 struct dynamic_y_step_type<any_image_view<Views...>>
146 template <
typename T>
150 using type = mp11::mp_transform<dynamic_step_view, any_image_view<Views...>>;
153 template <
typename ...Views>
154 struct dynamic_xy_step_type<any_image_view<Views...>>
161 template <
typename T>
162 using dynamic_step_view =
typename gil::dynamic_xy_step_type<T>::type;
165 using type = mp11::mp_transform<dynamic_step_view, any_image_view<Views...>>;
168 template <
typename ...Views>
169 struct dynamic_xy_step_transposed_type<any_image_view<Views...>>
176 template <
typename T>
177 using dynamic_step_view =
typename gil::dynamic_xy_step_type<T>::type;
180 using type = mp11::mp_transform<dynamic_step_view, any_image_view<Views...>>;
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:76
auto view(image< Pixel, IsPlanar, Alloc > &img) -> typename image< Pixel, IsPlanar, Alloc >::view_t const &
Returns the non-constant-pixel view of an image.
Definition: image.hpp:565
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17
Base template for types that model HasDynamicYStepTypeConcept.
Definition: dynamic_step.hpp:21
Returns the number of channels of a pixel-based GIL construct.
Definition: pixel.hpp:54
Returns an integral constant type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:42