2 // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 #include <boost/gil/dynamic_step.hpp>
9 #include <boost/gil/color_base.hpp> // kth_element_type
10 #include <boost/gil/pixel.hpp> // kth_element_type
11 #include <boost/gil/pixel_iterator.hpp>
12 #include <boost/gil/pixel_iterator_adaptor.hpp>
13 #include <boost/gil/planar_pixel_iterator.hpp> // kth_element_type
14 #include <boost/gil/planar_pixel_reference.hpp> // kth_element_type
15 #include <boost/gil/step_iterator.hpp>
16 #include <boost/gil/typedefs.hpp>
18 #include <type_traits>
20 namespace gil = boost::gil;
22 // NOTE: Iterator does not model HasDynamicYStepTypeConcept
23 // TODO: Add compile-fail tests to verify that.
25 template <typename Iterator>
28 static_assert(std::is_same
30 gil::memory_based_step_iterator<Iterator>,
31 typename gil::dynamic_x_step_type<Iterator>::type
32 >::value, "iterator does not model HasDynamicXStepTypeConcept");
34 static_assert(!std::is_same
37 typename gil::dynamic_x_step_type<Iterator>::type
38 >::value, "dynamic_x_step_type yields X step iterator, not X iterator");
41 template <typename Iterator>
44 static_assert(std::is_same
47 typename gil::dynamic_x_step_type<Iterator>::type
48 >::value, "iterator does not model HasDynamicXStepTypeConcept");
50 static_assert(!std::is_same
52 typename Iterator::x_iterator,
53 typename gil::dynamic_x_step_type<gil::gray8_step_ptr_t>::type
54 >::value, "dynamic_x_step_type yields X step iterator, not X iterator");
59 test_non_step<gil::gray8_ptr_t>();
60 test_non_step<gil::gray8c_ptr_t>();
61 test_non_step<gil::gray16_ptr_t>();
62 test_non_step<gil::gray16c_ptr_t>();
63 test_non_step<gil::gray32_ptr_t>();
64 test_non_step<gil::gray32c_ptr_t>();
65 test_non_step<gil::gray32f_ptr_t>();
66 test_step<gil::gray8_step_ptr_t>();
67 test_step<gil::gray8c_step_ptr_t>();
68 test_step<gil::gray16_step_ptr_t>();
69 test_step<gil::gray16c_step_ptr_t>();
70 test_step<gil::gray32_step_ptr_t>();
71 test_step<gil::gray32c_step_ptr_t>();
72 test_step<gil::gray32f_step_ptr_t>();
74 test_non_step<gil::abgr8_ptr_t>();
75 test_non_step<gil::abgr16_ptr_t>();
76 test_non_step<gil::abgr32_ptr_t>();
77 test_non_step<gil::abgr32f_ptr_t>();
78 test_step<gil::abgr8_step_ptr_t>();
79 test_step<gil::abgr16_step_ptr_t>();
80 test_step<gil::abgr32_step_ptr_t>();
81 test_step<gil::abgr32f_step_ptr_t>();
83 test_non_step<gil::argb8_ptr_t>();
84 test_non_step<gil::argb16_ptr_t>();
85 test_non_step<gil::argb32_ptr_t>();
86 test_non_step<gil::argb32f_ptr_t>();
87 test_step<gil::argb8_step_ptr_t>();
88 test_step<gil::argb16_step_ptr_t>();
89 test_step<gil::argb32_step_ptr_t>();
90 test_step<gil::argb32f_step_ptr_t>();
92 test_non_step<gil::bgr8_ptr_t>();
93 test_non_step<gil::bgr16_ptr_t>();
94 test_non_step<gil::bgr32_ptr_t>();
95 test_non_step<gil::bgr32f_ptr_t>();
96 test_step<gil::bgr8_step_ptr_t>();
97 test_step<gil::bgr16_step_ptr_t>();
98 test_step<gil::bgr32_step_ptr_t>();
99 test_step<gil::bgr32f_step_ptr_t>();
101 test_non_step<gil::bgra8_ptr_t>();
102 test_non_step<gil::bgra16_ptr_t>();
103 test_non_step<gil::bgra32_ptr_t>();
104 test_non_step<gil::bgra32f_ptr_t>();
105 test_step<gil::bgra8_step_ptr_t>();
106 test_step<gil::bgra16_step_ptr_t>();
107 test_step<gil::bgra32_step_ptr_t>();
108 test_step<gil::bgra32f_step_ptr_t>();
110 test_non_step<gil::rgb8_ptr_t>();
111 test_non_step<gil::rgb8_planar_ptr_t>();
112 test_non_step<gil::rgb16_ptr_t>();
113 test_non_step<gil::rgb16_planar_ptr_t>();
114 test_non_step<gil::rgb32_ptr_t>();
115 test_non_step<gil::rgb32_planar_ptr_t>();
116 test_non_step<gil::rgb32f_ptr_t>();
117 test_non_step<gil::rgb32f_planar_ptr_t>();
118 test_step<gil::rgb8_step_ptr_t>();
119 test_step<gil::rgb8_planar_step_ptr_t>();
120 test_step<gil::rgb16_step_ptr_t>();
121 test_step<gil::rgb16_planar_step_ptr_t>();
122 test_step<gil::rgb32_step_ptr_t>();
123 test_step<gil::rgb32_planar_step_ptr_t>();
124 test_step<gil::rgb32f_step_ptr_t>();
125 test_step<gil::rgb32f_planar_step_ptr_t>();
127 test_non_step<gil::rgba8_ptr_t>();
128 test_non_step<gil::rgba8_planar_ptr_t>();
129 test_non_step<gil::rgba16_ptr_t>();
130 test_non_step<gil::rgba16_planar_ptr_t>();
131 test_non_step<gil::rgba32_ptr_t>();
132 test_non_step<gil::rgba32_planar_ptr_t>();
133 test_non_step<gil::rgba32f_ptr_t>();
134 test_non_step<gil::rgba32f_planar_ptr_t>();
135 test_step<gil::rgba8_step_ptr_t>();
136 test_step<gil::rgba8_planar_step_ptr_t>();
137 test_step<gil::rgba16_step_ptr_t>();
138 test_step<gil::rgba16_planar_step_ptr_t>();
139 test_step<gil::rgba32_step_ptr_t>();
140 test_step<gil::rgba32_planar_step_ptr_t>();
141 test_step<gil::rgba32f_step_ptr_t>();
142 test_step<gil::rgba32f_planar_step_ptr_t>();
144 test_non_step<gil::cmyk8_ptr_t>();
145 test_non_step<gil::cmyk8_planar_ptr_t>();
146 test_non_step<gil::cmyk16_ptr_t>();
147 test_non_step<gil::cmyk16_planar_ptr_t>();
148 test_non_step<gil::cmyk32_ptr_t>();
149 test_non_step<gil::cmyk32_planar_ptr_t>();
150 test_non_step<gil::cmyk32f_ptr_t>();
151 test_non_step<gil::cmyk32f_planar_ptr_t>();
152 test_step<gil::cmyk8_step_ptr_t>();
153 test_step<gil::cmyk8_planar_step_ptr_t>();
154 test_step<gil::cmyk16_step_ptr_t>();
155 test_step<gil::cmyk16_planar_step_ptr_t>();
156 test_step<gil::cmyk32_step_ptr_t>();
157 test_step<gil::cmyk32_planar_step_ptr_t>();
158 test_step<gil::cmyk32f_step_ptr_t>();
159 test_step<gil::cmyk32f_planar_step_ptr_t>();