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_dereference.hpp> 15 #include <boost/gil/concepts/pixel_iterator.hpp> 16 #include <boost/gil/concepts/point.hpp> 17 #include <boost/gil/concepts/detail/utility.hpp> 21 #include <type_traits> 23 #if defined(BOOST_CLANG) 24 #pragma clang diagnostic push 25 #pragma clang diagnostic ignored "-Wunused-local-typedefs" 28 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 29 #pragma GCC diagnostic push 30 #pragma GCC diagnostic ignored "-Wunused-local-typedefs" 31 #pragma GCC diagnostic ignored "-Wunused-but-set-variable" 34 namespace boost {
namespace gil {
101 template <
typename Loc>
106 gil_function_requires<Regular<Loc>>();
110 using value_type =
typename Loc::value_type;
111 ignore_unused_variable_warning(value_type{});
114 using reference =
typename Loc::reference;
118 using difference_type =
typename Loc::difference_type;
119 ignore_unused_variable_warning(difference_type{});
122 using cached_location_t =
typename Loc::cached_location_t;
123 ignore_unused_variable_warning(cached_location_t{});
126 using const_t =
typename Loc::const_t;
127 ignore_unused_variable_warning(const_t{});
130 using point_t =
typename Loc::point_t;
131 ignore_unused_variable_warning(point_t{});
133 static std::size_t
const N = Loc::num_dimensions; ignore_unused_variable_warning(N);
135 using first_it_type =
typename Loc::template axis<0>::iterator;
136 using last_it_type =
typename Loc::template axis<N-1>::iterator;
137 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type>>();
138 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type>>();
142 gil_function_requires<PointNDConcept<point_t>>();
143 static_assert(point_t::num_dimensions == N,
"");
144 static_assert(std::is_same
146 typename std::iterator_traits<first_it_type>::difference_type,
147 typename point_t::template axis<0>::coord_t
149 static_assert(std::is_same
151 typename std::iterator_traits<last_it_type>::difference_type,
152 typename point_t::template axis<N-1>::coord_t
160 reference r1 = loc[d]; ignore_unused_variable_warning(r1);
161 reference r2 = *loc; ignore_unused_variable_warning(r2);
162 cached_location_t cl = loc.cache_location(d); ignore_unused_variable_warning(cl);
163 reference r3 = loc[d]; ignore_unused_variable_warning(r3);
165 first_it_type fi = loc.template axis_iterator<0>();
166 fi = loc.template axis_iterator<0>(d);
167 last_it_type li = loc.template axis_iterator<N-1>();
168 li = loc.template axis_iterator<N-1>(d);
170 using deref_t = PixelDereferenceAdaptorArchetype<typename Loc::value_type>;
171 using dtype =
typename Loc::template add_deref<deref_t>::type;
218 template <
typename Loc>
223 gil_function_requires<RandomAccessNDLocatorConcept<Loc>>();
224 static_assert(Loc::num_dimensions == 2,
"");
228 using transposed_t =
typename transposed_type<Loc>::type;
230 using cached_location_t =
typename Loc::cached_location_t;
231 gil_function_requires<Point2DConcept<typename Loc::point_t>>();
233 using x_iterator =
typename Loc::x_iterator;
234 using y_iterator =
typename Loc::y_iterator;
235 using x_coord_t =
typename Loc::x_coord_t;
236 using y_coord_t =
typename Loc::y_coord_t;
238 x_coord_t xd = 0; ignore_unused_variable_warning(xd);
239 y_coord_t yd = 0; ignore_unused_variable_warning(yd);
241 typename Loc::difference_type d;
242 typename Loc::reference r=loc(xd,yd); ignore_unused_variable_warning(r);
244 dynamic_x_step_t loc2(dynamic_x_step_t(), yd);
245 dynamic_x_step_t loc3(dynamic_x_step_t(), xd, yd);
251 dynamic_xy_step_transposed_t loc4(loc, xd,yd,
true);
253 bool is_contiguous = loc.is_1d_traversable(xd);
254 ignore_unused_variable_warning(is_contiguous);
256 loc.y_distance_to(loc, xd);
259 loc = loc.xy_at(xd, yd);
261 x_iterator xit = loc.x_at(d);
262 xit = loc.x_at(xd, yd);
265 y_iterator yit = loc.y_at(d);
266 yit = loc.y_at(xd, yd);
269 cached_location_t cl = loc.cache_location(xd, yd);
270 ignore_unused_variable_warning(cl);
288 template <
typename Loc>
293 gil_function_requires<RandomAccess2DLocatorConcept<Loc>>();
294 gil_function_requires<PixelIteratorConcept<typename Loc::x_iterator>>();
295 gil_function_requires<PixelIteratorConcept<typename Loc::y_iterator>>();
296 using coord_t =
typename Loc::coord_t;
297 static_assert(std::is_same<typename Loc::x_coord_t, typename Loc::y_coord_t>::value,
"");
305 template <
typename Loc>
310 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
312 typename Loc::template axis<0>::iterator
314 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
316 typename Loc::template axis<Loc::num_dimensions-1>::iterator
319 typename Loc::difference_type d; initialize_it(d);
320 typename Loc::value_type v; initialize_it(v);
321 typename Loc::cached_location_t cl = loc.cache_location(d);
330 template <
typename Loc>
331 struct RandomAccess2DLocatorIsMutableConcept
335 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc>>();
336 typename Loc::x_coord_t xd = 0; ignore_unused_variable_warning(xd);
337 typename Loc::y_coord_t yd = 0; ignore_unused_variable_warning(yd);
338 typename Loc::value_type v; initialize_it(v);
355 template <
typename Loc>
360 gil_function_requires<RandomAccessNDLocatorConcept<Loc>>();
361 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc>>();
372 template <
typename Loc>
377 gil_function_requires<RandomAccess2DLocatorConcept<Loc>>();
378 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc>>();
389 template <
typename Loc>
394 gil_function_requires<PixelLocatorConcept<Loc>>();
395 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc>>();
401 #if defined(BOOST_CLANG) 402 #pragma clang diagnostic pop 405 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 406 #pragma GCC diagnostic pop N-dimensional locator over mutable pixels.
Definition: pixel_locator.hpp:356
Definition: pixel_locator.hpp:306
Definition: algorithm.hpp:30
2-dimensional locator over mutable pixels
Definition: pixel_locator.hpp:373
2-dimensional locator over immutable values
Definition: pixel_locator.hpp:219
GIL's 2-dimensional locator over immutable GIL pixels.
Definition: pixel_locator.hpp:289
Base template for types that model HasDynamicYStepTypeConcept.
Definition: dynamic_step.hpp:21
N-dimensional locator over immutable values.
Definition: pixel_locator.hpp:102
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17
GIL's 2-dimensional locator over mutable GIL pixels.
Definition: pixel_locator.hpp:390