8 #ifndef BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_IMAGE_VIEW_FACTORY_HPP 9 #define BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_IMAGE_VIEW_FACTORY_HPP 11 #include <boost/gil/extension/dynamic_image/any_image_view.hpp> 13 #include <boost/gil/dynamic_step.hpp> 14 #include <boost/gil/image_view_factory.hpp> 15 #include <boost/gil/point.hpp> 16 #include <boost/gil/detail/mp11.hpp> 20 namespace boost {
namespace gil {
27 template <
typename ResultView>
28 struct flipped_up_down_view_fn
30 using result_type = ResultView;
32 template <
typename View>
33 auto operator()(View
const& src)
const -> result_type
39 template <
typename ResultView>
40 struct flipped_left_right_view_fn
42 using result_type = ResultView;
44 template <
typename View>
45 auto operator()(View
const& src)
const -> result_type
51 template <
typename ResultView>
52 struct rotated90cw_view_fn
54 using result_type = ResultView;
56 template <
typename View>
57 auto operator()(View
const& src)
const -> result_type
63 template <
typename ResultView>
64 struct rotated90ccw_view_fn
66 using result_type = ResultView;
68 template <
typename View>
69 auto operator()(View
const& src)
const -> result_type
75 template <
typename ResultView>
76 struct tranposed_view_fn
78 using result_type = ResultView;
80 template <
typename View>
81 auto operator()(View
const& src)
const -> result_type
83 return result_type{tranposed_view(src)};
87 template <
typename ResultView>
88 struct rotated180_view_fn
90 using result_type = ResultView;
92 template <
typename View>
93 auto operator()(View
const& src)
const -> result_type
99 template <
typename ResultView>
100 struct subimage_view_fn
102 using result_type = ResultView;
104 subimage_view_fn(point_t
const& topleft, point_t
const& dimensions)
105 : _topleft(topleft), _size2(dimensions)
108 template <
typename View>
109 auto operator()(View
const& src)
const -> result_type
118 template <
typename ResultView>
119 struct subsampled_view_fn
121 using result_type = ResultView;
123 subsampled_view_fn(point_t
const& step) : _step(step) {}
125 template <
typename View>
126 auto operator()(View
const& src)
const -> result_type
134 template <
typename ResultView>
135 struct nth_channel_view_fn
137 using result_type = ResultView;
139 nth_channel_view_fn(
int n) : _n(n) {}
141 template <
typename View>
142 auto operator()(View
const& src)
const -> result_type
150 template <
typename DstP,
typename ResultView,
typename CC = default_color_converter>
151 struct color_converted_view_fn
153 using result_type = ResultView;
155 color_converted_view_fn(CC cc = CC()): _cc(cc) {}
157 template <
typename View>
158 auto operator()(View
const& src)
const -> result_type
160 return result_type{color_converted_view<DstP>(src, _cc)};
171 template <
typename Views>
177 return apply_operation(src, detail::flipped_up_down_view_fn<result_view_t>());
182 template <
typename Views>
188 return apply_operation(src, detail::flipped_left_right_view_fn<result_view_t>());
193 template <
typename Views>
199 return apply_operation(src, detail::tranposed_view_fn<result_view_t>());
204 template <
typename Views>
210 return apply_operation(src,detail::rotated90cw_view_fn<result_view_t>());
215 template <
typename Views>
225 template <
typename Views>
236 template <
typename Views>
244 using subimage_view_fn = detail::subimage_view_fn<any_image_view<Views>>;
250 template <
typename Views>
254 std::ptrdiff_t x_min, std::ptrdiff_t y_min, std::ptrdiff_t width, std::ptrdiff_t height)
257 using subimage_view_fn = detail::subimage_view_fn<any_image_view<Views>>;
263 template <
typename Views>
275 template <
typename Views>
281 using subsampled_view_fn = detail::subsampled_view_fn<step_type>;
287 template <
typename View>
288 struct get_nthchannel_type {
using type =
typename nth_channel_view_type<View>::type; };
290 template <
typename Views>
291 struct views_get_nthchannel_type : mp11::mp_transform<get_nthchannel_type, Views> {};
297 template <
typename Views>
305 template <
typename Views>
311 return apply_operation(src,detail::nth_channel_view_fn<result_view_t>(n));
316 template <
typename View,
typename DstP,
typename CC>
317 struct get_ccv_type : color_converted_view_type<View, DstP, CC> {};
319 template <
typename Views,
typename DstP,
typename CC>
320 struct views_get_ccv_type
327 template <
typename T>
328 using ccvt = detail::get_ccv_type<T, DstP, CC>;
331 using type = mp11::mp_transform<ccvt, Views>;
338 template <
typename Views,
typename DstP,
typename CC>
347 template <
typename DstP,
typename Views,
typename CC>
353 return apply_operation(src, detail::color_converted_view_fn<DstP, cc_view_t>());
358 template <
typename Views,
typename DstP>
367 template <
typename DstP,
typename Views>
373 return apply_operation(src, detail::color_converted_view_fn<DstP, cc_view_t>());
380 template <
typename DstP,
typename Views,
typename CC>
386 return apply_operation(src, detail::color_converted_view_fn<DstP, cc_view_t>());
393 template <
typename DstP,
typename Views>
399 return apply_operation(src, detail::color_converted_view_fn<DstP, cc_view_t>());
Returns the type of a transposed view that has a dynamic step along both X and Y.
Definition: image_view_factory.hpp:51
Returns the type of a view that has a dynamic step along both X and Y.
Definition: dynamic_step.hpp:27
Given a source image view type View, returns the type of an image view over a single channel of ViewI...
Definition: image_view_factory.hpp:406
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:33
Returns the type of a view that does color conversion upon dereferencing its pixels.
Definition: image_view_factory.hpp:159
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:66
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17