channel_type.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #include <boost/gil/channel.hpp>
  11. #include <boost/gil/detail/is_channel_integral.hpp>
  12. #include <boost/test/unit_test.hpp>
  13. #include <type_traits>
  14. namespace bg = boost::gil;
  15. BOOST_AUTO_TEST_SUITE(toolbox_tests)
  16. BOOST_AUTO_TEST_CASE(channel_type_test)
  17. {
  18. static_assert(std::is_same
  19. <
  20. unsigned char,
  21. bg::channel_type<bg::rgb8_pixel_t>::type
  22. >::value, "");
  23. // float32_t is a scoped_channel_value object
  24. static_assert(std::is_same
  25. <
  26. bg::float32_t,
  27. bg::channel_type<bg::rgba32f_pixel_t>::type
  28. >::value, "");
  29. // channel_type for bit_aligned images doesn't work with standard gil.
  30. using image_t = bg::bit_aligned_image4_type<4, 4, 4, 4, bg::rgb_layout_t>::type;
  31. using channel_t = bg::channel_type<image_t::view_t::reference>::type;
  32. static_assert(bg::detail::is_channel_integral<channel_t>::value, "");
  33. }
  34. BOOST_AUTO_TEST_SUITE_END()