bit_aligned_pixel_reference.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
  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/bit_aligned_pixel_reference.hpp>
  9. #include <boost/gil/packed_pixel.hpp>
  10. #include <boost/gil/rgb.hpp>
  11. #include <boost/mp11.hpp>
  12. namespace gil = boost::gil;
  13. namespace mp11 = boost::mp11;
  14. int main()
  15. {
  16. using bgr121_ref_t = gil::bit_aligned_pixel_reference
  17. <
  18. std::uint8_t, mp11::mp_list_c<int, 1, 2, 1>, gil::bgr_layout_t, true
  19. >;
  20. static_assert(bgr121_ref_t::bit_size == 4,
  21. "bit size should be 4");
  22. static_assert(std::is_same<bgr121_ref_t::bitfield_t, std::uint8_t>::value,
  23. "bit field type should be std::uint8_t");
  24. static_assert(std::is_same<bgr121_ref_t::layout_t, gil::bgr_layout_t>::value,
  25. "layout type should be bgr");
  26. static_assert(std::is_same<decltype(bgr121_ref_t::is_mutable), bool const>::value &&
  27. bgr121_ref_t::is_mutable,
  28. "is_mutable should be boolean");
  29. using packed_pixel_t = gil::packed_pixel
  30. <
  31. std::uint8_t,
  32. typename gil::detail::packed_channel_references_vector_type
  33. <
  34. std::uint8_t, mp11::mp_list_c<int, 1, 2, 1>
  35. >::type,
  36. gil::bgr_layout_t
  37. >;
  38. static_assert(std::is_same<bgr121_ref_t::value_type, packed_pixel_t>::value,
  39. "value_type should be specialization of packed_pixel");
  40. }