Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / gil / extension / io / raw / detail / supported_types.hpp
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
11 #include <boost/gil/extension/io/raw/tags.hpp>
12
13 #include <boost/gil/channel.hpp>
14 #include <boost/gil/color_base.hpp>
15 #include <boost/gil/io/base.hpp>
16
17 #include <type_traits>
18
19 namespace boost { namespace gil { namespace detail {
20
21 // Read support
22
23 template< typename Channel
24         , typename ColorSpace
25         >
26 struct raw_read_support : read_support_false {};
27
28 template<>
29 struct raw_read_support<uint8_t
30                        , gray_t
31                        > : read_support_true {};
32
33 template<>
34 struct raw_read_support<uint16_t
35                        , gray_t
36                        > : read_support_true {};
37
38 template<>
39 struct raw_read_support<uint8_t
40                        , rgb_t
41                        > : read_support_true {};
42
43 template<>
44 struct raw_read_support<uint16_t
45                        , rgb_t
46                        > : read_support_true {};
47
48 // Write support
49
50 struct raw_write_support : write_support_false {};
51
52 } // namespace detail
53
54 template<typename Pixel>
55 struct is_read_supported<Pixel,raw_tag>
56     : std::integral_constant
57         <
58             bool,
59             detail::raw_read_support
60             <
61                 typename channel_type<Pixel>::type,
62                 typename color_space_type<Pixel>::type
63             >::is_supported
64         >
65 {};
66
67 template<typename Pixel>
68 struct is_write_supported<Pixel, raw_tag>
69     : std::integral_constant<bool, detail::raw_write_support::is_supported>
70 {};
71
72 }} // namespace boost::gil
73
74 #endif