]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/gil/test/extension/toolbox/channel_view.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / gil / test / extension / toolbox / channel_view.cpp
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_view.hpp>
10
11 #include <boost/core/lightweight_test.hpp>
12
13 #include <type_traits>
14
15 namespace gil = boost::gil;
16
17 void test_channel_view()
18 {
19 using kth_channel_view_t
20 = gil::kth_channel_view_type<0, gil::rgb8_view_t::const_t>::type;
21 using channel_view_t
22 = gil::channel_view_type<gil::red_t, gil::rgb8_view_t::const_t>::type;
23
24 static_assert(std::is_same
25 <
26 kth_channel_view_t,
27 channel_view_t
28 >::value,
29 "");
30
31 gil::rgb8_image_t img(100, 100);
32 kth_channel_view_t const kth0 = gil::kth_channel_view<0>(gil::const_view(img));
33 BOOST_TEST_EQ(kth0.num_channels(), 1u);
34
35 channel_view_t const red = gil::channel_view<gil::red_t>(gil::const_view(img));
36 BOOST_TEST_EQ(red.num_channels(), 1u);
37 }
38
39 int main()
40 {
41 test_channel_view();
42
43 return boost::report_errors();
44 }