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> 16 #include <boost/variant.hpp> 18 namespace boost {
namespace gil {
21 template <
typename View>
struct get_const_t {
using type =
typename View::const_t; };
22 template <
typename Views>
struct views_get_const_t :
public mpl::transform<Views, get_const_t<mpl::_1> > {};
25 template <
typename View>
struct dynamic_xy_step_transposed_type;
30 struct any_type_get_num_channels
32 using result_type = int;
34 result_type operator()(
const T&)
const {
return num_channels<T>::value; }
38 struct any_type_get_dimensions
40 using result_type = point<std::ptrdiff_t>;
42 result_type operator()(
const T& v)
const {
return v.dimensions(); }
60 template <
typename ImageViewTypes>
62 using parent_t =
typename make_variant_over<ImageViewTypes>::type;
65 using x_coord_t = std::ptrdiff_t;
66 using y_coord_t = std::ptrdiff_t;
70 template <
typename T>
explicit any_image_view(
const T& obj) : parent_t(obj) {}
74 template <
typename T>
any_image_view& operator=(
const T& obj) { parent_t::operator=(obj);
return *
this; }
76 template <
typename Types>
any_image_view& operator=(
const any_image_view<Types>& v) { parent_t::operator=((
const typename make_variant_over<Types>::type&)v);
return *
this;}
80 x_coord_t width()
const {
return dimensions().x; }
81 y_coord_t height()
const {
return dimensions().y; }
88 template <
typename IVTypes>
98 template <
typename IVTypes>
99 struct dynamic_y_step_type<any_image_view<IVTypes>>
101 using type = any_image_view<typename mpl::transform<IVTypes, dynamic_y_step_type<mpl::_1>>::type>;
104 template <
typename IVTypes>
105 struct dynamic_xy_step_type<any_image_view<IVTypes>>
107 using type = any_image_view<typename mpl::transform<IVTypes, dynamic_xy_step_type<mpl::_1>>::type>;
110 template <
typename IVTypes>
111 struct dynamic_xy_step_transposed_type<any_image_view<IVTypes>>
113 using type = any_image_view<typename mpl::transform<IVTypes, dynamic_xy_step_transposed_type<mpl::_1>>::type>;
BOOST_FORCEINLINE auto apply_operation(variant< Types > &arg, UnaryOp op)
Invokes a generic mutable operation (represented as a unary function object) on a variant.
Definition: apply_operation.hpp:31
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:61
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