8 #ifndef BOOST_GIL_CONCEPTS_IMAGE_VIEW_HPP 9 #define BOOST_GIL_CONCEPTS_IMAGE_VIEW_HPP 11 #include <boost/gil/concepts/basic.hpp> 12 #include <boost/gil/concepts/concept_check.hpp> 13 #include <boost/gil/concepts/fwd.hpp> 14 #include <boost/gil/concepts/pixel.hpp> 15 #include <boost/gil/concepts/pixel_dereference.hpp> 16 #include <boost/gil/concepts/pixel_iterator.hpp> 17 #include <boost/gil/concepts/pixel_locator.hpp> 18 #include <boost/gil/concepts/point.hpp> 19 #include <boost/gil/concepts/detail/utility.hpp> 23 #include <type_traits> 25 #if defined(BOOST_CLANG) 26 #pragma clang diagnostic push 27 #pragma clang diagnostic ignored "-Wunused-local-typedefs" 30 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 31 #pragma GCC diagnostic push 32 #pragma GCC diagnostic ignored "-Wunused-local-typedefs" 33 #pragma GCC diagnostic ignored "-Wunused-but-set-variable" 36 namespace boost {
namespace gil {
101 template <
typename View>
106 gil_function_requires<Regular<View>>();
108 using value_type =
typename View::value_type;
109 using reference =
typename View::reference;
110 using pointer =
typename View::pointer;
111 using difference_type =
typename View::difference_type;
112 using const_t =
typename View::const_t;
113 using point_t =
typename View::point_t;
114 using locator =
typename View::locator;
115 using iterator =
typename View::iterator;
116 using const_iterator =
typename View::const_iterator;
117 using reverse_iterator =
typename View::reverse_iterator;
118 using size_type =
typename View::size_type;
119 static const std::size_t N=View::num_dimensions;
121 gil_function_requires<RandomAccessNDLocatorConcept<locator>>();
122 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<iterator>>();
123 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<reverse_iterator>>();
125 using first_it_type =
typename View::template axis<0>::iterator;
126 using last_it_type =
typename View::template axis<N-1>::iterator;
127 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type>>();
128 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type>>();
134 gil_function_requires<PointNDConcept<point_t>>();
135 static_assert(point_t::num_dimensions == N,
"");
136 static_assert(std::is_same
138 typename std::iterator_traits<first_it_type>::difference_type,
139 typename point_t::template axis<0>::coord_t
141 static_assert(std::is_same
143 typename std::iterator_traits<last_it_type>::difference_type,
144 typename point_t::template axis<N-1>::coord_t
150 reverse_iterator rit;
151 difference_type d; detail::initialize_it(d); ignore_unused_variable_warning(d);
155 p = view.dimensions();
157 size_type sz = view.size(); ignore_unused_variable_warning(sz);
158 bool is_contiguous = view.is_1d_traversable();
159 ignore_unused_variable_warning(is_contiguous);
166 reference r1 = view[d]; ignore_unused_variable_warning(r1);
167 reference r2 = view(p); ignore_unused_variable_warning(r2);
170 first_it_type fi = view.template axis_iterator<0>(p);
171 ignore_unused_variable_warning(fi);
172 last_it_type li = view.template axis_iterator<N-1>(p);
173 ignore_unused_variable_warning(li);
175 using deref_t = PixelDereferenceAdaptorArchetype<typename View::value_type>;
176 using dtype =
typename View::template add_deref<deref_t>::type;
219 template <
typename View>
224 gil_function_requires<RandomAccessNDImageViewConcept<View>>();
225 static_assert(View::num_dimensions == 2,
"");
228 gil_function_requires<RandomAccess2DLocatorConcept<typename View::locator>>();
232 using transposed_t =
typename transposed_type<View>::type;
233 using x_iterator =
typename View::x_iterator;
234 using y_iterator =
typename View::y_iterator;
235 using x_coord_t =
typename View::x_coord_t;
236 using y_coord_t =
typename View::y_coord_t;
237 using xy_locator =
typename View::xy_locator;
239 x_coord_t xd = 0; ignore_unused_variable_warning(xd);
240 y_coord_t yd = 0; ignore_unused_variable_warning(yd);
243 typename View::point_t d;
245 View(xd, yd, xy_locator());
247 xy_locator lc = view.xy_at(xd, yd);
250 typename View::reference r = view(xd, yd);
251 ignore_unused_variable_warning(r);
256 xit = view.x_at(xd,yd);
257 xit = view.row_begin(xd);
258 xit = view.row_end(xd);
261 yit = view.y_at(xd,yd);
262 yit = view.col_begin(xd);
263 yit = view.col_end(xd);
272 template <
typename View>
277 using value_type =
typename View::value_type;
278 using iterator =
typename View::iterator;
279 using const_iterator =
typename View::const_iterator;
280 using reference =
typename View::reference;
281 using const_reference =
typename View::const_reference;
282 using pointer =
typename View::pointer;
283 using difference_type =
typename View::difference_type;
284 using size_type=
typename View::size_type;
297 ignore_unused_variable_warning(s);
311 template <
typename View>
316 gil_function_requires<CollectionImageViewConcept<View>>();
318 using reference =
typename View::reference;
319 using const_reference =
typename View::const_reference;
321 reference r = view.front();
322 ignore_unused_variable_warning(r);
324 const_reference cr = view.front();
325 ignore_unused_variable_warning(cr);
334 template <
typename View>
339 gil_function_requires<CollectionImageViewConcept<View>>();
341 using reverse_iterator =
typename View::reverse_iterator;
342 using reference =
typename View::reference;
343 using const_reference =
typename View::const_reference;
349 reference r = view.back();
350 ignore_unused_variable_warning(r);
352 const_reference cr = view.back();
353 ignore_unused_variable_warning(cr);
373 template <
typename View>
378 gil_function_requires<RandomAccess2DImageViewConcept<View>>();
381 gil_function_requires<PixelLocatorConcept<typename View::xy_locator>>();
383 static_assert(std::is_same<typename View::x_coord_t, typename View::y_coord_t>::value,
"");
385 using coord_t =
typename View::coord_t;
386 std::size_t num_chan = view.num_channels(); ignore_unused_variable_warning(num_chan);
394 template <
typename View>
399 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<typename View::locator>>();
401 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::iterator>>();
403 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
405 typename View::reverse_iterator
408 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
410 typename View::template axis<0>::iterator
413 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
415 typename View::template axis<View::num_dimensions - 1>::iterator
418 typename View::difference_type diff;
420 ignore_unused_variable_warning(diff);
422 typename View::point_t pt;
423 typename View::value_type v;
433 template <
typename View>
438 gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View>>();
439 typename View::x_coord_t xd = 0; ignore_unused_variable_warning(xd);
440 typename View::y_coord_t yd = 0; ignore_unused_variable_warning(yd);
441 typename View::value_type v; initialize_it(v);
448 template <
typename View>
453 gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View>>();
468 template <
typename View>
473 gil_function_requires<RandomAccessNDImageViewConcept<View>>();
474 gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View>>();
485 template <
typename View>
490 gil_function_requires<RandomAccess2DImageViewConcept<View>>();
491 gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View>>();
502 template <
typename View>
507 gil_function_requires<ImageViewConcept<View>>();
508 gil_function_requires<detail::PixelImageViewIsMutableConcept<View>>();
520 template <
typename V1,
typename V2>
537 template <
typename V1,
typename V2>
548 #if defined(BOOST_CLANG) 549 #pragma clang diagnostic pop 552 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 553 #pragma GCC diagnostic pop 2-dimensional view over mutable values
Definition: concepts/image_view.hpp:486
Definition: concepts/image_view.hpp:395
N-dimensional view over mutable values.
Definition: concepts/image_view.hpp:469
GIL view as Collection.
Definition: concepts/image_view.hpp:273
Returns whether two views are compatible.
Definition: concepts/image_view.hpp:521
GIL view as ReversibleCollection.
Definition: concepts/image_view.hpp:335
Definition: concepts/image_view.hpp:434
Base template for types that model HasDynamicYStepTypeConcept.
Definition: dynamic_step.hpp:21
GIL's 2-dimensional view over mutable GIL pixels.
Definition: concepts/image_view.hpp:503
Returns whether two pixels are compatible Pixels are compatible if their channels and color space typ...
Definition: concepts/pixel.hpp:225
GIL's 2-dimensional view over immutable GIL pixels.
Definition: concepts/image_view.hpp:374
2-dimensional view over immutable values
Definition: concepts/image_view.hpp:220
GIL view as ForwardCollection.
Definition: concepts/image_view.hpp:312
Views are compatible if they have the same color spaces and compatible channel values.
Definition: concepts/image_view.hpp:538
N-dimensional view over immutable values.
Definition: concepts/image_view.hpp:102
Definition: concepts/image_view.hpp:449
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17