8 #ifndef BOOST_GIL_CONCEPTS_PIXEL_LOCATOR_HPP
9 #define BOOST_GIL_CONCEPTS_PIXEL_LOCATOR_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/point.hpp>
18 #include <boost/gil/concepts/detail/utility.hpp>
22 #include <type_traits>
24 #if defined(BOOST_CLANG)
25 #pragma clang diagnostic push
26 #pragma clang diagnostic ignored "-Wunknown-pragmas"
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 {
103 template <
typename Loc>
108 gil_function_requires<Regular<Loc>>();
112 using value_type =
typename Loc::value_type;
113 ignore_unused_variable_warning(value_type{});
116 using reference =
typename Loc::reference;
120 using difference_type =
typename Loc::difference_type;
121 ignore_unused_variable_warning(difference_type{});
124 using cached_location_t =
typename Loc::cached_location_t;
125 ignore_unused_variable_warning(cached_location_t{});
128 using const_t =
typename Loc::const_t;
129 ignore_unused_variable_warning(const_t{});
132 using point_t =
typename Loc::point_t;
133 ignore_unused_variable_warning(
point_t{});
135 static std::size_t
const N = Loc::num_dimensions; ignore_unused_variable_warning(N);
137 using first_it_type =
typename Loc::template axis<0>::iterator;
138 using last_it_type =
typename Loc::template axis<N-1>::iterator;
139 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type>>();
140 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type>>();
144 gil_function_requires<PointNDConcept<point_t>>();
145 static_assert(point_t::num_dimensions == N,
"");
146 static_assert(std::is_same
148 typename std::iterator_traits<first_it_type>::difference_type,
149 typename point_t::template axis<0>::coord_t
151 static_assert(std::is_same
153 typename std::iterator_traits<last_it_type>::difference_type,
154 typename point_t::template axis<N-1>::coord_t
162 reference r1 = loc[d]; ignore_unused_variable_warning(r1);
163 reference r2 = *loc; ignore_unused_variable_warning(r2);
164 cached_location_t cl = loc.cache_location(d); ignore_unused_variable_warning(cl);
165 reference r3 = loc[d]; ignore_unused_variable_warning(r3);
167 first_it_type fi = loc.template axis_iterator<0>();
168 fi = loc.template axis_iterator<0>(d);
169 last_it_type li = loc.template axis_iterator<N-1>();
170 li = loc.template axis_iterator<N-1>(d);
172 using deref_t = PixelDereferenceAdaptorArchetype<typename Loc::value_type>;
173 using dtype =
typename Loc::template add_deref<deref_t>::type;
220 template <
typename Loc>
225 gil_function_requires<RandomAccessNDLocatorConcept<Loc>>();
226 static_assert(Loc::num_dimensions == 2,
"");
230 using transposed_t =
typename transposed_type<Loc>::type;
232 using cached_location_t =
typename Loc::cached_location_t;
233 gil_function_requires<Point2DConcept<typename Loc::point_t>>();
235 using x_iterator =
typename Loc::x_iterator;
236 using y_iterator =
typename Loc::y_iterator;
237 using x_coord_t =
typename Loc::x_coord_t;
238 using y_coord_t =
typename Loc::y_coord_t;
240 x_coord_t xd = 0; ignore_unused_variable_warning(xd);
241 y_coord_t yd = 0; ignore_unused_variable_warning(yd);
243 typename Loc::difference_type d;
244 typename Loc::reference r=loc(xd,yd); ignore_unused_variable_warning(r);
246 dynamic_x_step_t loc2(dynamic_x_step_t(), yd);
247 dynamic_x_step_t loc3(dynamic_x_step_t(), xd, yd);
253 dynamic_xy_step_transposed_t loc4(loc, xd,yd,
true);
255 bool is_contiguous = loc.is_1d_traversable(xd);
256 ignore_unused_variable_warning(is_contiguous);
258 loc.y_distance_to(loc, xd);
261 loc = loc.xy_at(xd, yd);
263 x_iterator xit = loc.x_at(d);
264 xit = loc.x_at(xd, yd);
267 y_iterator yit = loc.y_at(d);
268 yit = loc.y_at(xd, yd);
271 cached_location_t cl = loc.cache_location(xd, yd);
272 ignore_unused_variable_warning(cl);
290 template <
typename Loc>
295 gil_function_requires<RandomAccess2DLocatorConcept<Loc>>();
296 gil_function_requires<PixelIteratorConcept<typename Loc::x_iterator>>();
297 gil_function_requires<PixelIteratorConcept<typename Loc::y_iterator>>();
298 using coord_t =
typename Loc::coord_t;
299 static_assert(std::is_same<typename Loc::x_coord_t, typename Loc::y_coord_t>::value,
"");
307 template <
typename Loc>
312 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
314 typename Loc::template axis<0>::iterator
316 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
318 typename Loc::template axis<Loc::num_dimensions-1>::iterator
321 typename Loc::difference_type d; initialize_it(d);
322 typename Loc::value_type v; initialize_it(v);
323 typename Loc::cached_location_t cl = loc.cache_location(d);
332 template <
typename Loc>
333 struct RandomAccess2DLocatorIsMutableConcept
337 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc>>();
338 typename Loc::x_coord_t xd = 0; ignore_unused_variable_warning(xd);
339 typename Loc::y_coord_t yd = 0; ignore_unused_variable_warning(yd);
340 typename Loc::value_type v; initialize_it(v);
357 template <
typename Loc>
362 gil_function_requires<RandomAccessNDLocatorConcept<Loc>>();
363 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc>>();
374 template <
typename Loc>
379 gil_function_requires<RandomAccess2DLocatorConcept<Loc>>();
380 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc>>();
391 template <
typename Loc>
396 gil_function_requires<PixelLocatorConcept<Loc>>();
397 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc>>();
403 #if defined(BOOST_CLANG)
404 #pragma clang diagnostic pop
407 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
408 #pragma GCC diagnostic pop
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36
GIL's 2-dimensional locator over mutable GIL pixels.
Definition: pixel_locator.hpp:393
2-dimensional locator over mutable pixels
Definition: pixel_locator.hpp:376
N-dimensional locator over mutable pixels.
Definition: pixel_locator.hpp:359
GIL's 2-dimensional locator over immutable GIL pixels.
Definition: pixel_locator.hpp:292
2-dimensional locator over immutable values
Definition: pixel_locator.hpp:222
N-dimensional locator over immutable values.
Definition: pixel_locator.hpp:105
Definition: pixel_locator.hpp:309
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17
Base template for types that model HasDynamicYStepTypeConcept.
Definition: dynamic_step.hpp:21