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 "-Wunused-local-typedefs" 29 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 30 #pragma GCC diagnostic push 31 #pragma GCC diagnostic ignored "-Wunused-local-typedefs" 32 #pragma GCC diagnostic ignored "-Wunused-but-set-variable" 35 namespace boost {
namespace gil {
102 template <
typename Loc>
107 gil_function_requires<Regular<Loc>>();
111 using value_type =
typename Loc::value_type;
112 ignore_unused_variable_warning(value_type{});
115 using reference =
typename Loc::reference;
119 using difference_type =
typename Loc::difference_type;
120 ignore_unused_variable_warning(difference_type{});
123 using cached_location_t =
typename Loc::cached_location_t;
124 ignore_unused_variable_warning(cached_location_t{});
127 using const_t =
typename Loc::const_t;
128 ignore_unused_variable_warning(const_t{});
131 using point_t =
typename Loc::point_t;
132 ignore_unused_variable_warning(
point_t{});
134 static std::size_t
const N = Loc::num_dimensions; ignore_unused_variable_warning(N);
136 using first_it_type =
typename Loc::template axis<0>::iterator;
137 using last_it_type =
typename Loc::template axis<N-1>::iterator;
138 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<first_it_type>>();
139 gil_function_requires<boost_concepts::RandomAccessTraversalConcept<last_it_type>>();
143 gil_function_requires<PointNDConcept<point_t>>();
144 static_assert(point_t::num_dimensions == N,
"");
145 static_assert(std::is_same
147 typename std::iterator_traits<first_it_type>::difference_type,
148 typename point_t::template axis<0>::coord_t
150 static_assert(std::is_same
152 typename std::iterator_traits<last_it_type>::difference_type,
153 typename point_t::template axis<N-1>::coord_t
161 reference r1 = loc[d]; ignore_unused_variable_warning(r1);
162 reference r2 = *loc; ignore_unused_variable_warning(r2);
163 cached_location_t cl = loc.cache_location(d); ignore_unused_variable_warning(cl);
164 reference r3 = loc[d]; ignore_unused_variable_warning(r3);
166 first_it_type fi = loc.template axis_iterator<0>();
167 fi = loc.template axis_iterator<0>(d);
168 last_it_type li = loc.template axis_iterator<N-1>();
169 li = loc.template axis_iterator<N-1>(d);
171 using deref_t = PixelDereferenceAdaptorArchetype<typename Loc::value_type>;
172 using dtype =
typename Loc::template add_deref<deref_t>::type;
219 template <
typename Loc>
224 gil_function_requires<RandomAccessNDLocatorConcept<Loc>>();
225 static_assert(Loc::num_dimensions == 2,
"");
229 using transposed_t =
typename transposed_type<Loc>::type;
231 using cached_location_t =
typename Loc::cached_location_t;
232 gil_function_requires<Point2DConcept<typename Loc::point_t>>();
234 using x_iterator =
typename Loc::x_iterator;
235 using y_iterator =
typename Loc::y_iterator;
236 using x_coord_t =
typename Loc::x_coord_t;
237 using y_coord_t =
typename Loc::y_coord_t;
239 x_coord_t xd = 0; ignore_unused_variable_warning(xd);
240 y_coord_t yd = 0; ignore_unused_variable_warning(yd);
242 typename Loc::difference_type d;
243 typename Loc::reference r=loc(xd,yd); ignore_unused_variable_warning(r);
245 dynamic_x_step_t loc2(dynamic_x_step_t(), yd);
246 dynamic_x_step_t loc3(dynamic_x_step_t(), xd, yd);
252 dynamic_xy_step_transposed_t loc4(loc, xd,yd,
true);
254 bool is_contiguous = loc.is_1d_traversable(xd);
255 ignore_unused_variable_warning(is_contiguous);
257 loc.y_distance_to(loc, xd);
260 loc = loc.xy_at(xd, yd);
262 x_iterator xit = loc.x_at(d);
263 xit = loc.x_at(xd, yd);
266 y_iterator yit = loc.y_at(d);
267 yit = loc.y_at(xd, yd);
270 cached_location_t cl = loc.cache_location(xd, yd);
271 ignore_unused_variable_warning(cl);
289 template <
typename Loc>
294 gil_function_requires<RandomAccess2DLocatorConcept<Loc>>();
295 gil_function_requires<PixelIteratorConcept<typename Loc::x_iterator>>();
296 gil_function_requires<PixelIteratorConcept<typename Loc::y_iterator>>();
297 using coord_t =
typename Loc::coord_t;
298 static_assert(std::is_same<typename Loc::x_coord_t, typename Loc::y_coord_t>::value,
"");
306 template <
typename Loc>
311 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
313 typename Loc::template axis<0>::iterator
315 gil_function_requires<detail::RandomAccessIteratorIsMutableConcept
317 typename Loc::template axis<Loc::num_dimensions-1>::iterator
320 typename Loc::difference_type d; initialize_it(d);
321 typename Loc::value_type v; initialize_it(v);
322 typename Loc::cached_location_t cl = loc.cache_location(d);
331 template <
typename Loc>
332 struct RandomAccess2DLocatorIsMutableConcept
336 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc>>();
337 typename Loc::x_coord_t xd = 0; ignore_unused_variable_warning(xd);
338 typename Loc::y_coord_t yd = 0; ignore_unused_variable_warning(yd);
339 typename Loc::value_type v; initialize_it(v);
356 template <
typename Loc>
361 gil_function_requires<RandomAccessNDLocatorConcept<Loc>>();
362 gil_function_requires<detail::RandomAccessNDLocatorIsMutableConcept<Loc>>();
373 template <
typename Loc>
378 gil_function_requires<RandomAccess2DLocatorConcept<Loc>>();
379 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc>>();
390 template <
typename Loc>
395 gil_function_requires<PixelLocatorConcept<Loc>>();
396 gil_function_requires<detail::RandomAccess2DLocatorIsMutableConcept<Loc>>();
402 #if defined(BOOST_CLANG) 403 #pragma clang diagnostic pop 406 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 407 #pragma GCC diagnostic pop N-dimensional locator over mutable pixels.
Definition: pixel_locator.hpp:357
Definition: pixel_locator.hpp:307
2-dimensional locator over mutable pixels
Definition: pixel_locator.hpp:374
2-dimensional locator over immutable values
Definition: pixel_locator.hpp:220
GIL's 2-dimensional locator over immutable GIL pixels.
Definition: pixel_locator.hpp:290
Base template for types that model HasDynamicYStepTypeConcept.
Definition: dynamic_step.hpp:21
N-dimensional locator over immutable values.
Definition: pixel_locator.hpp:103
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:391