Ticket #2831: image_view_factory.hpp.patch

File image_view_factory.hpp.patch, 17.1 KB (added by Adrien Chauve <adrien.chauve@…>, 14 years ago)

patch

Line 
1*** ../../boost-trunk/boost/gil/extension/dynamic_image/image_view_factory.hpp 2009-03-04 21:44:31.000000000 +0100
2--- image_view_factory.hpp 2009-03-04 21:50:15.000000000 +0100
3***************
4*** 1,6 ****
5 /*
6 Copyright 2005-2007 Adobe Systems Incorporated
7!
8 Use, modification and distribution are subject to the Boost Software License,
9 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 http://www.boost.org/LICENSE_1_0.txt).
11--- 1,6 ----
12 /*
13 Copyright 2005-2007 Adobe Systems Incorporated
14!
15 Use, modification and distribution are subject to the Boost Software License,
16 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 http://www.boost.org/LICENSE_1_0.txt).
18***************
19*** 14,20 ****
20 #define GIL_DYNAMICIMAGE_IMAGE_VIEWS_HPP
21
22 /*!
23! /// \file
24 /// \brief Methods for constructing any image views from other any image views
25 /// \author Lubomir Bourdev and Hailin Jin \n
26 /// Adobe Systems Incorporated
27--- 14,20 ----
28 #define GIL_DYNAMICIMAGE_IMAGE_VIEWS_HPP
29
30 /*!
31! /// \file
32 /// \brief Methods for constructing any image views from other any image views
33 /// \author Lubomir Bourdev and Hailin Jin \n
34 /// Adobe Systems Incorporated
35***************
36*** 70,79 ****
37 int _n;
38 template <typename View> result_type operator()(const View& src) const { return result_type(nth_channel_view(src,_n)); }
39 };
40! template <typename DstP, typename Result> struct color_converted_view_fn {
41 typedef Result result_type;
42! template <typename View> result_type operator()(const View& src) const { return result_type(color_converted_view<DstP>(src)); }
43 };
44 } // namespace detail
45
46
47--- 70,87 ----
48 int _n;
49 template <typename View> result_type operator()(const View& src) const { return result_type(nth_channel_view(src,_n)); }
50 };
51!
52! template <typename DstP, typename Result, typename CC = default_color_converter> struct color_converted_view_fn {
53 typedef Result result_type;
54! color_converted_view_fn(CC cc = CC()):
55! _cc(cc) {}
56!
57! template <typename View> result_type operator()(const View& src) const { return result_type(color_converted_view<DstP>(src, _cc)); }
58!
59! private:
60! CC _cc;
61 };
62+
63 } // namespace detail
64
65
66***************
67*** 79,140 ****
68
69 /// \ingroup ImageViewTransformationsFlipUD
70 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
71! typename dynamic_y_step_type<any_image_view<ViewTypes> >::type flipped_up_down_view(const any_image_view<ViewTypes>& src) {
72! return apply_operation(src,detail::flipped_up_down_view_fn<typename dynamic_y_step_type<any_image_view<ViewTypes> >::type>());
73 }
74
75 /// \ingroup ImageViewTransformationsFlipLR
76 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
77! typename dynamic_x_step_type<any_image_view<ViewTypes> >::type flipped_left_right_view(const any_image_view<ViewTypes>& src) {
78! return apply_operation(src,detail::flipped_left_right_view_fn<typename dynamic_x_step_type<any_image_view<ViewTypes> >::type>());
79 }
80
81 /// \ingroup ImageViewTransformationsTransposed
82 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
83! typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type transposed_view(const any_image_view<ViewTypes>& src) {
84! return apply_operation(src,detail::tranposed_view_fn<typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type>());
85 }
86
87 /// \ingroup ImageViewTransformations90CW
88 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
89! typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type rotated90cw_view(const any_image_view<ViewTypes>& src) {
90! return apply_operation(src,detail::rotated90cw_view_fn<typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type>());
91 }
92
93 /// \ingroup ImageViewTransformations90CCW
94 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
95! typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type rotated90ccw_view(const any_image_view<ViewTypes>& src) {
96! return apply_operation(src,detail::rotated90ccw_view_fn<typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type>());
97 }
98
99 /// \ingroup ImageViewTransformations180
100 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
101! typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type rotated180_view(const any_image_view<ViewTypes>& src) {
102! return apply_operation(src,detail::rotated180_view_fn<typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type>());
103 }
104
105 /// \ingroup ImageViewTransformationsSubimage
106 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
107! any_image_view<ViewTypes> subimage_view(const any_image_view<ViewTypes>& src, const point2<std::ptrdiff_t>& topleft, const point2<std::ptrdiff_t>& dimensions) {
108! return apply_operation(src,detail::subimage_view_fn<any_image_view<ViewTypes> >(topleft,dimensions));
109 }
110
111 /// \ingroup ImageViewTransformationsSubimage
112 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
113! any_image_view<ViewTypes> subimage_view(const any_image_view<ViewTypes>& src, int xMin, int yMin, int width, int height) {
114! return apply_operation(src,detail::subimage_view_fn<any_image_view<ViewTypes> >(point2<std::ptrdiff_t>(xMin,yMin),point2<std::ptrdiff_t>(width,height)));
115 }
116
117 /// \ingroup ImageViewTransformationsSubsampled
118 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
119! typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type subsampled_view(const any_image_view<ViewTypes>& src, const point2<std::ptrdiff_t>& step) {
120! return apply_operation(src,detail::subsampled_view_fn<typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type>(step));
121 }
122
123 /// \ingroup ImageViewTransformationsSubsampled
124 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
125! typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type subsampled_view(const any_image_view<ViewTypes>& src, int xStep, int yStep) {
126! return apply_operation(src,detail::subsampled_view_fn<typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type>(point2<std::ptrdiff_t>(xStep,yStep)));
127 }
128
129 namespace detail {
130--- 87,148 ----
131
132 /// \ingroup ImageViewTransformationsFlipUD
133 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
134! typename dynamic_y_step_type<any_image_view<ViewTypes> >::type flipped_up_down_view(const any_image_view<ViewTypes>& src) {
135! return apply_operation(src,detail::flipped_up_down_view_fn<typename dynamic_y_step_type<any_image_view<ViewTypes> >::type>());
136 }
137
138 /// \ingroup ImageViewTransformationsFlipLR
139 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
140! typename dynamic_x_step_type<any_image_view<ViewTypes> >::type flipped_left_right_view(const any_image_view<ViewTypes>& src) {
141! return apply_operation(src,detail::flipped_left_right_view_fn<typename dynamic_x_step_type<any_image_view<ViewTypes> >::type>());
142 }
143
144 /// \ingroup ImageViewTransformationsTransposed
145 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
146! typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type transposed_view(const any_image_view<ViewTypes>& src) {
147! return apply_operation(src,detail::tranposed_view_fn<typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type>());
148 }
149
150 /// \ingroup ImageViewTransformations90CW
151 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
152! typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type rotated90cw_view(const any_image_view<ViewTypes>& src) {
153! return apply_operation(src,detail::rotated90cw_view_fn<typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type>());
154 }
155
156 /// \ingroup ImageViewTransformations90CCW
157 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
158! typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type rotated90ccw_view(const any_image_view<ViewTypes>& src) {
159! return apply_operation(src,detail::rotated90ccw_view_fn<typename dynamic_xy_step_transposed_type<any_image_view<ViewTypes> >::type>());
160 }
161
162 /// \ingroup ImageViewTransformations180
163 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
164! typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type rotated180_view(const any_image_view<ViewTypes>& src) {
165! return apply_operation(src,detail::rotated180_view_fn<typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type>());
166 }
167
168 /// \ingroup ImageViewTransformationsSubimage
169 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
170! any_image_view<ViewTypes> subimage_view(const any_image_view<ViewTypes>& src, const point2<std::ptrdiff_t>& topleft, const point2<std::ptrdiff_t>& dimensions) {
171! return apply_operation(src,detail::subimage_view_fn<any_image_view<ViewTypes> >(topleft,dimensions));
172 }
173
174 /// \ingroup ImageViewTransformationsSubimage
175 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
176! any_image_view<ViewTypes> subimage_view(const any_image_view<ViewTypes>& src, int xMin, int yMin, int width, int height) {
177! return apply_operation(src,detail::subimage_view_fn<any_image_view<ViewTypes> >(point2<std::ptrdiff_t>(xMin,yMin),point2<std::ptrdiff_t>(width,height)));
178 }
179
180 /// \ingroup ImageViewTransformationsSubsampled
181 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
182! typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type subsampled_view(const any_image_view<ViewTypes>& src, const point2<std::ptrdiff_t>& step) {
183! return apply_operation(src,detail::subsampled_view_fn<typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type>(step));
184 }
185
186 /// \ingroup ImageViewTransformationsSubsampled
187 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
188! typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type subsampled_view(const any_image_view<ViewTypes>& src, int xStep, int yStep) {
189! return apply_operation(src,detail::subsampled_view_fn<typename dynamic_xy_step_type<any_image_view<ViewTypes> >::type>(point2<std::ptrdiff_t>(xStep,yStep)));
190 }
191
192 namespace detail {
193***************
194*** 151,158 ****
195
196 /// \ingroup ImageViewTransformationsNthChannel
197 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
198! typename nth_channel_view_type<any_image_view<ViewTypes> >::type nth_channel_view(const any_image_view<ViewTypes>& src, int n) {
199! return apply_operation(src,detail::nth_channel_view_fn<typename nth_channel_view_type<any_image_view<ViewTypes> >::type>(n));
200 }
201
202 namespace detail {
203--- 159,166 ----
204
205 /// \ingroup ImageViewTransformationsNthChannel
206 template <typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
207! typename nth_channel_view_type<any_image_view<ViewTypes> >::type nth_channel_view(const any_image_view<ViewTypes>& src, int n) {
208! return apply_operation(src,detail::nth_channel_view_fn<typename nth_channel_view_type<any_image_view<ViewTypes> >::type>(n));
209 }
210
211 namespace detail {
212***************
213*** 170,177 ****
214 /// \ingroup ImageViewTransformationsColorConvert
215 /// \brief overload of generic color_converted_view with user defined color-converter
216 template <typename DstP, typename ViewTypes, typename CC> inline // Models MPL Random Access Container of models of ImageViewConcept
217! typename color_converted_view_type<any_image_view<ViewTypes>, DstP, CC>::type color_converted_view(const any_image_view<ViewTypes>& src,CC cc) {
218! return apply_operation(src,detail::color_converted_view_fn<DstP,typename color_converted_view_type<any_image_view<ViewTypes>, DstP, CC>::type >());
219 }
220
221 /// \ingroup ImageViewTransformationsColorConvert
222--- 178,185 ----
223 /// \ingroup ImageViewTransformationsColorConvert
224 /// \brief overload of generic color_converted_view with user defined color-converter
225 template <typename DstP, typename ViewTypes, typename CC> inline // Models MPL Random Access Container of models of ImageViewConcept
226! typename color_converted_view_type<any_image_view<ViewTypes>, DstP, CC>::type color_converted_view(const any_image_view<ViewTypes>& src,CC cc) {
227! return apply_operation(src,detail::color_converted_view_fn<DstP,typename color_converted_view_type<any_image_view<ViewTypes>, DstP, CC>::type >());
228 }
229
230 /// \ingroup ImageViewTransformationsColorConvert
231***************
232*** 184,191 ****
233 /// \ingroup ImageViewTransformationsColorConvert
234 /// \brief overload of generic color_converted_view with the default color-converter
235 template <typename DstP, typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
236! typename color_converted_view_type<any_image_view<ViewTypes>, DstP>::type color_converted_view(const any_image_view<ViewTypes>& src) {
237! return apply_operation(src,detail::color_converted_view_fn<DstP,typename color_converted_view_type<any_image_view<ViewTypes>, DstP>::type >());
238 }
239
240
241--- 192,199 ----
242 /// \ingroup ImageViewTransformationsColorConvert
243 /// \brief overload of generic color_converted_view with the default color-converter
244 template <typename DstP, typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
245! typename color_converted_view_type<any_image_view<ViewTypes>, DstP>::type color_converted_view(const any_image_view<ViewTypes>& src) {
246! return apply_operation(src,detail::color_converted_view_fn<DstP,typename color_converted_view_type<any_image_view<ViewTypes>, DstP>::type >());
247 }
248
249
250***************
251*** 193,208 ****
252 /// \brief overload of generic color_converted_view with user defined color-converter
253 /// These are workarounds for GCC 3.4, which thinks color_converted_view is ambiguous with the same method for templated views (in gil/image_view_factory.hpp)
254 template <typename DstP, typename ViewTypes, typename CC> inline // Models MPL Random Access Container of models of ImageViewConcept
255! typename color_converted_view_type<any_image_view<ViewTypes>, DstP, CC>::type any_color_converted_view(const any_image_view<ViewTypes>& src,CC cc) {
256! return apply_operation(src,detail::color_converted_view_fn<DstP,typename color_converted_view_type<any_image_view<ViewTypes>, DstP, CC>::type >());
257 }
258
259 /// \ingroup ImageViewTransformationsColorConvert
260 /// \brief overload of generic color_converted_view with the default color-converter
261 /// These are workarounds for GCC 3.4, which thinks color_converted_view is ambiguous with the same method for templated views (in gil/image_view_factory.hpp)
262 template <typename DstP, typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
263! typename color_converted_view_type<any_image_view<ViewTypes>, DstP>::type any_color_converted_view(const any_image_view<ViewTypes>& src) {
264! return apply_operation(src,detail::color_converted_view_fn<DstP,typename color_converted_view_type<any_image_view<ViewTypes>, DstP>::type >());
265 }
266
267 /// \}
268--- 201,216 ----
269 /// \brief overload of generic color_converted_view with user defined color-converter
270 /// These are workarounds for GCC 3.4, which thinks color_converted_view is ambiguous with the same method for templated views (in gil/image_view_factory.hpp)
271 template <typename DstP, typename ViewTypes, typename CC> inline // Models MPL Random Access Container of models of ImageViewConcept
272! typename color_converted_view_type<any_image_view<ViewTypes>, DstP, CC>::type any_color_converted_view(const any_image_view<ViewTypes>& src,CC cc) {
273! return apply_operation(src,detail::color_converted_view_fn<DstP,typename color_converted_view_type<any_image_view<ViewTypes>, DstP, CC>::type, CC>(cc));
274 }
275
276 /// \ingroup ImageViewTransformationsColorConvert
277 /// \brief overload of generic color_converted_view with the default color-converter
278 /// These are workarounds for GCC 3.4, which thinks color_converted_view is ambiguous with the same method for templated views (in gil/image_view_factory.hpp)
279 template <typename DstP, typename ViewTypes> inline // Models MPL Random Access Container of models of ImageViewConcept
280! typename color_converted_view_type<any_image_view<ViewTypes>, DstP>::type any_color_converted_view(const any_image_view<ViewTypes>& src) {
281! return apply_operation(src,detail::color_converted_view_fn<DstP,typename color_converted_view_type<any_image_view<ViewTypes>, DstP>::type >());
282 }
283
284 /// \}