supported_types.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // Copyright 2008 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. #ifndef BOOST_GIL_EXTENSION_IO_RAW_DETAIL_SUPPORTED_TYPES_HPP
  9. #define BOOST_GIL_EXTENSION_IO_RAW_DETAIL_SUPPORTED_TYPES_HPP
  10. #include <boost/gil/extension/io/raw/tags.hpp>
  11. #include <boost/gil/channel.hpp>
  12. #include <boost/gil/color_base.hpp>
  13. #include <boost/gil/io/base.hpp>
  14. #include <type_traits>
  15. namespace boost { namespace gil { namespace detail {
  16. // Read support
  17. template< typename Channel
  18. , typename ColorSpace
  19. >
  20. struct raw_read_support : read_support_false {};
  21. template<>
  22. struct raw_read_support<uint8_t
  23. , gray_t
  24. > : read_support_true {};
  25. template<>
  26. struct raw_read_support<uint16_t
  27. , gray_t
  28. > : read_support_true {};
  29. template<>
  30. struct raw_read_support<uint8_t
  31. , rgb_t
  32. > : read_support_true {};
  33. template<>
  34. struct raw_read_support<uint16_t
  35. , rgb_t
  36. > : read_support_true {};
  37. // Write support
  38. struct raw_write_support : write_support_false {};
  39. } // namespace detail
  40. template<typename Pixel>
  41. struct is_read_supported<Pixel,raw_tag>
  42. : std::integral_constant
  43. <
  44. bool,
  45. detail::raw_read_support
  46. <
  47. typename channel_type<Pixel>::type,
  48. typename color_space_type<Pixel>::type
  49. >::is_supported
  50. >
  51. {};
  52. template<typename Pixel>
  53. struct is_write_supported<Pixel, raw_tag>
  54. : std::integral_constant<bool, detail::raw_write_support::is_supported>
  55. {};
  56. }} // namespace boost::gil
  57. #endif