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.hpp>
9 #include <boost/gil/extension/toolbox/metafunctions/channel_type.hpp>
10 #include <boost/gil/extension/toolbox/metafunctions/get_num_bits.hpp>
11
12 namespace gil = boost::gil;
13
test_get_num_bits()14 void test_get_num_bits()
15 {
16 using image_t = gil::bit_aligned_image4_type<4, 4, 4, 4, gil::rgb_layout_t>::type;
17
18 using channel_t = gil::channel_type<image_t::view_t::reference>::type;
19 static_assert(gil::get_num_bits<channel_t>::value == 4, "");
20
21 using const_channel_t = gil::channel_type<image_t::const_view_t::reference>::type;
22 static_assert(gil::get_num_bits<const_channel_t>::value == 4, "");
23
24 using bits_t = gil::packed_channel_value<23>;
25 static_assert(gil::get_num_bits<bits_t>::value == 23, "");
26 static_assert(gil::get_num_bits<bits_t const>::value == 23, "");
27
28 static_assert(gil::get_num_bits<unsigned char >::value == 8, "");
29 static_assert(gil::get_num_bits<unsigned char const>::value == 8, "");
30
31 using gray8_channel_t = gil::channel_type<gil::gray8_image_t::view_t::value_type>::type;
32 static_assert(gil::get_num_bits<gray8_channel_t>::value == 8, "");
33
34 using rgba32_channel_t = gil::channel_type<gil::rgba32_image_t::view_t::value_type>::type;
35 static_assert(gil::get_num_bits<rgba32_channel_t>::value == 32, "");
36 }
37
main()38 int main()
39 {
40 test_get_num_bits();
41 }
42