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 Pixel
, typename IsPlanar
, typename IsStepX
, typename IsMutable
>
24 static_assert(std::is_same
26 typename
gil::view_type_from_pixel
34 >::value
, "view_type_from_pixel yields unexpected view");
37 template <typename ResultView
, typename Pixel
, typename IsPlanar
, typename IsStepX
, typename IsMutable
>
40 static_assert(!std::is_same
42 typename
gil::view_type_from_pixel
50 >::value
, "view_type_from_pixel yields unexpected view");
55 test
<gil::gray8_view_t
, gil::gray8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
56 test
<gil::gray8c_view_t
, gil::gray8c_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
57 // Immutable view from mutable pixel type is allowed
58 test
<gil::gray8c_view_t
, gil::gray8_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
59 // Mutable view from immutable pixel type not allowed
60 test_not
<gil::gray8_view_t
, gil::gray8c_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
62 test
<gil::gray8_step_view_t
, gil::gray8_pixel_t
, Interleaved
, StepX
, Mutable
>();
63 test_not
<gil::gray8_view_t
, gil::gray8c_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
64 test
<gil::gray8c_step_view_t
, gil::gray8_pixel_t
, Interleaved
, StepX
, Immutable
>();
65 test_not
<gil::gray8_view_t
, gil::gray8_pixel_t
, Planar
, NotStepX
, Mutable
>();
66 test_not
<gil::gray8_view_t
, gil::rgb8_pixel_t
, Planar
, NotStepX
, Mutable
>();
67 test_not
<gil::gray8_view_t
, gil::gray8_pixel_t
, Interleaved
, StepX
, Mutable
>();
68 test_not
<gil::gray8_view_t
, gil::gray8_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
70 test
<gil::abgr8_view_t
, gil::abgr8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
71 test
<gil::abgr8c_view_t
, gil::abgr8_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
72 test
<gil::abgr8_step_view_t
, gil::abgr8_pixel_t
, Interleaved
, StepX
, Mutable
>();
73 test
<gil::abgr8c_step_view_t
, gil::abgr8_pixel_t
, Interleaved
, StepX
, Immutable
>();
74 test_not
<gil::abgr8_view_t
, gil::bgra8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
75 test_not
<gil::abgr8_view_t
, gil::rgba8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
77 test
<gil::argb8_view_t
, gil::argb8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
78 test
<gil::argb8c_view_t
, gil::argb8_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
79 test
<gil::argb8_step_view_t
, gil::argb8_pixel_t
, Interleaved
, StepX
, Mutable
>();
80 test
<gil::argb8c_step_view_t
, gil::argb8_pixel_t
, Interleaved
, StepX
, Immutable
>();
82 test
<gil::bgr8_view_t
, gil::bgr8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
83 test
<gil::bgr8c_view_t
, gil::bgr8_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
84 test
<gil::bgr8_step_view_t
, gil::bgr8_pixel_t
, Interleaved
, StepX
, Mutable
>();
85 test
<gil::bgr8c_step_view_t
, gil::bgr8_pixel_t
, Interleaved
, StepX
, Immutable
>();
86 test_not
<gil::bgr8_view_t
, gil::rgb8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
88 test
<gil::bgra8_view_t
, gil::bgra8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
89 test
<gil::bgra8c_view_t
, gil::bgra8_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
90 test
<gil::bgra8_step_view_t
, gil::bgra8_pixel_t
, Interleaved
, StepX
, Mutable
>();
91 test
<gil::bgra8c_step_view_t
, gil::bgra8_pixel_t
, Interleaved
, StepX
, Immutable
>();
92 test_not
<gil::bgra8_view_t
, gil::abgr8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
93 test_not
<gil::bgra8_view_t
, gil::rgba8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
95 test
<gil::rgb8_view_t
, gil::rgb8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
96 test
<gil::rgb8c_view_t
, gil::rgb8_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
97 test
<gil::rgb8_step_view_t
, gil::rgb8_pixel_t
, Interleaved
, StepX
, Mutable
>();
98 test
<gil::rgb8c_step_view_t
, gil::rgb8_pixel_t
, Interleaved
, StepX
, Immutable
>();
99 test_not
<gil::rgb8_view_t
, gil::rgb8c_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
100 test_not
<gil::rgb8_view_t
, gil::rgb8_pixel_t
, Planar
, NotStepX
, Mutable
>();
101 test_not
<gil::rgb8_view_t
, gil::abgr8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
102 test_not
<gil::rgb8_view_t
, gil::bgra8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
104 test
<gil::rgb8_planar_view_t
, gil::rgb8_pixel_t
, Planar
, NotStepX
, Mutable
>();
105 test
<gil::rgb8c_planar_view_t
, gil::rgb8_pixel_t
, Planar
, NotStepX
, Immutable
>();
106 test
<gil::rgb8_planar_step_view_t
, gil::rgb8_pixel_t
, Planar
, StepX
, Mutable
>();
107 test
<gil::rgb8c_planar_step_view_t
, gil::rgb8_pixel_t
, Planar
, StepX
, Immutable
>();
109 test
<gil::cmyk8_view_t
, gil::cmyk8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
110 test
<gil::cmyk8c_view_t
, gil::cmyk8_pixel_t
, Interleaved
, NotStepX
, Immutable
>();
111 test
<gil::cmyk8_step_view_t
, gil::cmyk8_pixel_t
, Interleaved
, StepX
, Mutable
>();
112 test
<gil::cmyk8c_step_view_t
, gil::cmyk8_pixel_t
, Interleaved
, StepX
, Immutable
>();
113 test_not
<gil::cmyk8_view_t
, gil::rgba8_pixel_t
, Interleaved
, NotStepX
, Mutable
>();
115 test
<gil::cmyk8_planar_view_t
, gil::cmyk8_pixel_t
, Planar
, NotStepX
, Mutable
>();
116 test
<gil::cmyk8c_planar_view_t
, gil::cmyk8_pixel_t
, Planar
, NotStepX
, Immutable
>();
117 test
<gil::cmyk8_planar_step_view_t
, gil::cmyk8_pixel_t
, Planar
, StepX
, Mutable
>();
118 test
<gil::cmyk8c_planar_step_view_t
, gil::cmyk8_pixel_t
, Planar
, StepX
, Immutable
>();