1 //
2 // Copyright 2013 Christian Henning
3 //
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
7 //
8 #include <boost/gil/extension/toolbox/metafunctions/channel_type.hpp>
9 #include <boost/gil/extension/toolbox/metafunctions/is_bit_aligned.hpp>
10
11 #include <boost/gil/channel.hpp>
12 #include <boost/gil/packed_pixel.hpp>
13 #include <boost/gil/detail/is_channel_integral.hpp>
14
15 #include <type_traits>
16
17 namespace gil = boost::gil;
18
test_channel_type()19 void test_channel_type()
20 {
21 static_assert(std::is_same
22 <
23 unsigned char,
24 gil::channel_type<gil::rgb8_pixel_t>::type
25 >::value, "");
26
27 // float32_t is a scoped_channel_value object
28 static_assert(std::is_same
29 <
30 gil::float32_t,
31 gil::channel_type<gil::rgba32f_pixel_t>::type
32 >::value, "");
33
34 // channel_type for bit_aligned images doesn't work with standard gil.
35 using image_t = gil::bit_aligned_image4_type<4, 4, 4, 4, gil::rgb_layout_t>::type;
36 using channel_t = gil::channel_type<image_t::view_t::reference>::type;
37 static_assert(gil::detail::is_channel_integral<channel_t>::value, "");
38 }
39
main()40 int main()
41 {
42 test_channel_type();
43 }
44