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.hpp>
10 #include <type_traits>
12 namespace gil = boost::gil;
14 struct Interleaved : std::false_type {};
15 struct Planar : std::true_type {};
16 struct NotStepX : std::false_type {};
17 struct StepX : std::true_type {};
18 struct Immutable : std::false_type {};
19 struct Mutable : std::true_type {};
21 template <typename ResultView, typename Layout, typename IsPlanar, typename IsStepX, typename IsMutable>
24 static_assert(std::is_same
26 typename gil::view_type
35 >::value, "view_type yields unexpected view");
38 template <typename ResultView, typename Layout, typename IsPlanar, typename IsStepX, typename IsMutable>
41 static_assert(!std::is_same
43 typename gil::view_type
52 >::value, "view_type yields unexpected view");
57 test<gil::gray8_view_t, gil::gray_layout_t, Interleaved, NotStepX, Mutable>();
58 test<gil::gray8c_view_t, gil::gray_layout_t, Interleaved, NotStepX, Immutable>();
59 test<gil::gray8_step_view_t, gil::gray_layout_t, Interleaved, StepX, Mutable>();
60 test<gil::gray8c_step_view_t, gil::gray_layout_t, Interleaved, StepX, Immutable>();
61 test_not<gil::gray8_view_t, gil::gray_layout_t, Planar, NotStepX, Mutable>();
62 test_not<gil::gray8_view_t, gil::rgb_layout_t, Planar, NotStepX, Mutable>();
63 test_not<gil::gray8_view_t, gil::gray_layout_t, Interleaved, StepX, Mutable>();
64 test_not<gil::gray8_view_t, gil::gray_layout_t, Interleaved, NotStepX, Immutable>();
66 test<gil::abgr8_view_t, gil::abgr_layout_t, Interleaved, NotStepX, Mutable>();
67 test<gil::abgr8c_view_t, gil::abgr_layout_t, Interleaved, NotStepX, Immutable>();
68 test<gil::abgr8_step_view_t, gil::abgr_layout_t, Interleaved, StepX, Mutable>();
69 test<gil::abgr8c_step_view_t, gil::abgr_layout_t, Interleaved, StepX, Immutable>();
70 test_not<gil::abgr8_view_t, gil::bgra_layout_t, Interleaved, NotStepX, Mutable>();
71 test_not<gil::abgr8_view_t, gil::rgba_layout_t, Interleaved, NotStepX, Mutable>();
73 test<gil::argb8_view_t, gil::argb_layout_t, Interleaved, NotStepX, Mutable>();
74 test<gil::argb8c_view_t, gil::argb_layout_t, Interleaved, NotStepX, Immutable>();
75 test<gil::argb8_step_view_t, gil::argb_layout_t, Interleaved, StepX, Mutable>();
76 test<gil::argb8c_step_view_t, gil::argb_layout_t, Interleaved, StepX, Immutable>();
78 test<gil::bgr8_view_t, gil::bgr_layout_t, Interleaved, NotStepX, Mutable>();
79 test<gil::bgr8c_view_t, gil::bgr_layout_t, Interleaved, NotStepX, Immutable>();
80 test<gil::bgr8_step_view_t, gil::bgr_layout_t, Interleaved, StepX, Mutable>();
81 test<gil::bgr8c_step_view_t, gil::bgr_layout_t, Interleaved, StepX, Immutable>();
82 test_not<gil::bgr8_view_t, gil::rgb_layout_t, Interleaved, NotStepX, Mutable>();
84 test<gil::bgra8_view_t, gil::bgra_layout_t, Interleaved, NotStepX, Mutable>();
85 test<gil::bgra8c_view_t, gil::bgra_layout_t, Interleaved, NotStepX, Immutable>();
86 test<gil::bgra8_step_view_t, gil::bgra_layout_t, Interleaved, StepX, Mutable>();
87 test<gil::bgra8c_step_view_t, gil::bgra_layout_t, Interleaved, StepX, Immutable>();
88 test_not<gil::bgra8_view_t, gil::abgr_layout_t, Interleaved, NotStepX, Mutable>();
89 test_not<gil::bgra8_view_t, gil::rgba_layout_t, Interleaved, NotStepX, Mutable>();
91 test<gil::rgb8_view_t, gil::rgb_layout_t, Interleaved, NotStepX, Mutable>();
92 test<gil::rgb8c_view_t, gil::rgb_layout_t, Interleaved, NotStepX, Immutable>();
93 test<gil::rgb8_step_view_t, gil::rgb_layout_t, Interleaved, StepX, Mutable>();
94 test<gil::rgb8c_step_view_t, gil::rgb_layout_t, Interleaved, StepX, Immutable>();
95 test_not<gil::rgb8_view_t, gil::rgb_layout_t, Planar, NotStepX, Mutable>();
96 test_not<gil::rgb8_view_t, gil::abgr_layout_t, Interleaved, NotStepX, Mutable>();
97 test_not<gil::rgb8_view_t, gil::bgra_layout_t, Interleaved, NotStepX, Mutable>();
99 test<gil::rgb8_planar_view_t, gil::rgb_layout_t, Planar, NotStepX, Mutable>();
100 test<gil::rgb8c_planar_view_t, gil::rgb_layout_t, Planar, NotStepX, Immutable>();
101 test<gil::rgb8_planar_step_view_t, gil::rgb_layout_t, Planar, StepX, Mutable>();
102 test<gil::rgb8c_planar_step_view_t, gil::rgb_layout_t, Planar, StepX, Immutable>();
104 test<gil::cmyk8_view_t, gil::cmyk_layout_t, Interleaved, NotStepX, Mutable>();
105 test<gil::cmyk8c_view_t, gil::cmyk_layout_t, Interleaved, NotStepX, Immutable>();
106 test<gil::cmyk8_step_view_t, gil::cmyk_layout_t, Interleaved, StepX, Mutable>();
107 test<gil::cmyk8c_step_view_t, gil::cmyk_layout_t, Interleaved, StepX, Immutable>();
108 test_not<gil::cmyk8_view_t, gil::rgba_layout_t, Interleaved, NotStepX, Mutable>();
110 test<gil::cmyk8_planar_view_t, gil::cmyk_layout_t, Planar, NotStepX, Mutable>();
111 test<gil::cmyk8c_planar_view_t, gil::cmyk_layout_t, Planar, NotStepX, Immutable>();
112 test<gil::cmyk8_planar_step_view_t, gil::cmyk_layout_t, Planar, StepX, Mutable>();
113 test<gil::cmyk8c_planar_step_view_t, gil::cmyk_layout_t, Planar, StepX, Immutable>();