is_channel_integral.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
  3. // Copyright 2005-2007 Adobe Systems Incorporated
  4. //
  5. // Distributed under the Boost Software License, Version 1.0
  6. // See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt
  8. //
  9. #ifndef BOOST_GIL_DETAIL_IS_CHANNEL_INTEGRAL_HPP
  10. #define BOOST_GIL_DETAIL_IS_CHANNEL_INTEGRAL_HPP
  11. #include <boost/gil/channel.hpp>
  12. #include <type_traits>
  13. namespace boost { namespace gil { namespace detail {
  14. template <typename ChannelValue>
  15. struct is_channel_integral : std::is_integral<ChannelValue> {};
  16. template <int NumBits>
  17. struct is_channel_integral<boost::gil::packed_channel_value<NumBits>> : std::true_type {};
  18. template <typename BitField, int FirstBit, int NumBits, bool IsMutable>
  19. struct is_channel_integral
  20. <
  21. boost::gil::packed_channel_reference<BitField, FirstBit, NumBits, IsMutable>
  22. > : std::true_type
  23. {};
  24. template <typename BitField, int NumBits, bool IsMutable>
  25. struct is_channel_integral
  26. <
  27. boost::gil::packed_dynamic_channel_reference<BitField, NumBits, IsMutable>
  28. > : std::true_type
  29. {};
  30. template <typename BaseChannelValue, typename MinVal, typename MaxVal>
  31. struct is_channel_integral
  32. <
  33. boost::gil::scoped_channel_value<BaseChannelValue, MinVal, MaxVal>
  34. > : std::is_integral<BaseChannelValue>
  35. {};
  36. }}} //namespace boost::gil::detail
  37. #endif