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 "-Wunknown-pragmas"
28 #pragma clang diagnostic ignored "-Wunused-local-typedefs"
31 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
32 #pragma GCC diagnostic push
33 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
34 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
37 namespace boost {
namespace gil {
102 template <
typename View>
107 gil_function_requires<Regular<View>>();
109 using value_type =
typename View::value_type;
110 using reference =
typename View::reference;
111 using pointer =
typename View::pointer;
112 using difference_type =
typename View::difference_type;
113 using const_t =
typename View::const_t;
114 using point_t =
typename View::point_t;
115 using locator =
typename View::locator;
116 using iterator =
typename View::iterator;
117 using const_iterator =
typename View::const_iterator;
118 using reverse_iterator =
typename View::reverse_iterator;
119 using size_type =
typename View::size_type;
120 static const std::size_t N=View::num_dimensions;
122 gil_function_requires<RandomAccessNDLocatorConcept<locator>>();
123 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<iterator>>();
124 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<reverse_iterator>>();
126 using first_it_type =
typename View::template axis<0>::iterator;
127 using last_it_type =
typename View::template axis<N-1>::iterator;
128 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type>>();
129 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type>>();
135 gil_function_requires<PointNDConcept<point_t>>();
136 static_assert(point_t::num_dimensions == N,
"");
137 static_assert(std::is_same
139 typename std::iterator_traits<first_it_type>::difference_type,
140 typename point_t::template axis<0>::coord_t
142 static_assert(std::is_same
144 typename std::iterator_traits<last_it_type>::difference_type,
145 typename point_t::template axis<N-1>::coord_t
151 reverse_iterator rit;
152 difference_type d; detail::initialize_it(d); ignore_unused_variable_warning(d);
156 p = view.dimensions();
158 size_type sz = view.size(); ignore_unused_variable_warning(sz);
159 bool is_contiguous = view.is_1d_traversable();
160 ignore_unused_variable_warning(is_contiguous);
167 reference r1 = view[d]; ignore_unused_variable_warning(r1);
168 reference r2 = view(p); ignore_unused_variable_warning(r2);
171 first_it_type fi = view.template axis_iterator<0>(p);
172 ignore_unused_variable_warning(fi);
173 last_it_type li = view.template axis_iterator<N-1>(p);
174 ignore_unused_variable_warning(li);
176 using deref_t = PixelDereferenceAdaptorArchetype<typename View::value_type>;
177 using dtype =
typename View::template add_deref<deref_t>::type;
220 template <
typename View>
225 gil_function_requires<RandomAccessNDImageViewConcept<View>>();
226 static_assert(View::num_dimensions == 2,
"");
229 gil_function_requires<RandomAccess2DLocatorConcept<typename View::locator>>();
233 using transposed_t =
typename transposed_type<View>::type;
234 using x_iterator =
typename View::x_iterator;
235 using y_iterator =
typename View::y_iterator;
236 using x_coord_t =
typename View::x_coord_t;
237 using y_coord_t =
typename View::y_coord_t;
238 using xy_locator =
typename View::xy_locator;
240 x_coord_t xd = 0; ignore_unused_variable_warning(xd);
241 y_coord_t yd = 0; ignore_unused_variable_warning(yd);
244 typename View::point_t d;
246 View(xd, yd, xy_locator());
248 xy_locator lc = view.xy_at(xd, yd);
251 typename View::reference r = view(xd, yd);
252 ignore_unused_variable_warning(r);
257 xit = view.x_at(xd,yd);
258 xit = view.row_begin(xd);
259 xit = view.row_end(xd);
262 yit = view.y_at(xd,yd);
263 yit = view.col_begin(xd);
264 yit = view.col_end(xd);
273 template <
typename View>
278 using value_type =
typename View::value_type;
279 using iterator =
typename View::iterator;
280 using const_iterator =
typename View::const_iterator;
281 using reference =
typename View::reference;
282 using const_reference =
typename View::const_reference;
283 using pointer =
typename View::pointer;
284 using difference_type =
typename View::difference_type;
285 using size_type=
typename View::size_type;
298 ignore_unused_variable_warning(s);
312 template <
typename View>
317 gil_function_requires<CollectionImageViewConcept<View>>();
319 using reference =
typename View::reference;
320 using const_reference =
typename View::const_reference;
322 reference r = view.front();
323 ignore_unused_variable_warning(r);
325 const_reference cr = view.front();
326 ignore_unused_variable_warning(cr);
335 template <
typename View>
340 gil_function_requires<CollectionImageViewConcept<View>>();
342 using reverse_iterator =
typename View::reverse_iterator;
343 using reference =
typename View::reference;
344 using const_reference =
typename View::const_reference;
350 reference r = view.back();
351 ignore_unused_variable_warning(r);
353 const_reference cr = view.back();
354 ignore_unused_variable_warning(cr);
374 template <
typename View>
379 gil_function_requires<RandomAccess2DImageViewConcept<View>>();
382 gil_function_requires<PixelLocatorConcept<typename View::xy_locator>>();
384 static_assert(std::is_same<typename View::x_coord_t, typename View::y_coord_t>::value,
"");
386 using coord_t =
typename View::coord_t;
387 std::size_t num_chan = view.num_channels(); ignore_unused_variable_warning(num_chan);
395 template <
typename View>
400 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<typename View::locator>>();
402 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept<typename View::iterator>>();
404 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
406 typename View::reverse_iterator
409 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
411 typename View::template axis<0>::iterator
414 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
416 typename View::template axis<View::num_dimensions - 1>::iterator
419 typename View::difference_type diff;
421 ignore_unused_variable_warning(diff);
423 typename View::point_t pt;
424 typename View::value_type v;
434 template <
typename View>
439 gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View>>();
440 typename View::x_coord_t xd = 0; ignore_unused_variable_warning(xd);
441 typename View::y_coord_t yd = 0; ignore_unused_variable_warning(yd);
442 typename View::value_type v; initialize_it(v);
449 template <
typename View>
454 gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View>>();
469 template <
typename View>
474 gil_function_requires<RandomAccessNDImageViewConcept<View>>();
475 gil_function_requires<detail::RandomAccessNDImageViewIsMutableConcept<View>>();
486 template <
typename View>
491 gil_function_requires<RandomAccess2DImageViewConcept<View>>();
492 gil_function_requires<detail::RandomAccess2DImageViewIsMutableConcept<View>>();
503 template <
typename View>
508 gil_function_requires<ImageViewConcept<View>>();
509 gil_function_requires<detail::PixelImageViewIsMutableConcept<View>>();
521 template <
typename V1,
typename V2>
538 template <
typename V1,
typename V2>
549 #if defined(BOOST_CLANG)
550 #pragma clang diagnostic pop
553 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
554 #pragma GCC diagnostic pop
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36
GIL view as Collection.
Definition: concepts/image_view.hpp:275
GIL view as ForwardCollection.
Definition: concepts/image_view.hpp:314
GIL's 2-dimensional view over immutable GIL pixels.
Definition: concepts/image_view.hpp:376
GIL's 2-dimensional view over mutable GIL pixels.
Definition: concepts/image_view.hpp:505
2-dimensional view over mutable values
Definition: concepts/image_view.hpp:488
N-dimensional view over mutable values.
Definition: concepts/image_view.hpp:471
2-dimensional view over immutable values
Definition: concepts/image_view.hpp:222
N-dimensional view over immutable values.
Definition: concepts/image_view.hpp:104
GIL view as ReversibleCollection.
Definition: concepts/image_view.hpp:337
Views are compatible if they have the same color spaces and compatible channel values.
Definition: concepts/image_view.hpp:540
Definition: concepts/image_view.hpp:451
Definition: concepts/image_view.hpp:436
Definition: concepts/image_view.hpp:397
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 whether two pixels are compatible Pixels are compatible if their channels and color space typ...
Definition: concepts/pixel.hpp:239
Returns whether two views are compatible.
Definition: concepts/image_view.hpp:524