2 // Copyright 2008 Christian Henning
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
8 #ifndef BOOST_GIL_EXTENSION_IO_BMP_DETAIL_SUPPORTED_TYPES_HPP
9 #define BOOST_GIL_EXTENSION_IO_BMP_DETAIL_SUPPORTED_TYPES_HPP
11 #include <boost/gil/extension/io/bmp/tags.hpp>
13 #include <boost/gil/bit_aligned_pixel_reference.hpp>
14 #include <boost/gil/channel.hpp>
15 #include <boost/gil/color_base.hpp>
16 #include <boost/gil/packed_pixel.hpp>
17 #include <boost/gil/io/base.hpp>
19 #include <type_traits>
21 namespace boost { namespace gil { namespace detail {
25 template< typename Channel
28 struct bmp_read_support : read_support_false
30 static const bmp_bits_per_pixel::type bpp = 0;
33 template< typename BitField
36 struct bmp_read_support< packed_dynamic_channel_reference< BitField
43 static const bmp_bits_per_pixel::type bpp = 1;
46 template< typename BitField
49 struct bmp_read_support< packed_dynamic_channel_reference< BitField
56 static const bmp_bits_per_pixel::type bpp = 4;
61 struct bmp_read_support<uint8_t
65 static const bmp_bits_per_pixel::type bpp = 8;
71 struct bmp_read_support<uint8_t
75 static const bmp_bits_per_pixel::type bpp = 24;
80 struct bmp_read_support<uint8_t
84 static const bmp_bits_per_pixel::type bpp = 32;
90 template< typename Channel
93 struct bmp_write_support : write_support_false
97 struct bmp_write_support<uint8_t
99 > : write_support_true {};
102 struct bmp_write_support<uint8_t
104 > : write_support_true {};
106 } // namespace detail
108 template<typename Pixel>
109 struct is_read_supported<Pixel, bmp_tag>
110 : std::integral_constant
113 detail::bmp_read_support
115 typename channel_type<Pixel>::type,
116 typename color_space_type<Pixel>::type
120 using parent_t = detail::bmp_read_support
122 typename channel_type<Pixel>::type,
123 typename color_space_type<Pixel>::type
126 static const typename bmp_bits_per_pixel::type bpp = parent_t::bpp;
129 template<typename Pixel>
130 struct is_write_supported<Pixel, bmp_tag>
131 : std::integral_constant
134 detail::bmp_write_support
136 typename channel_type<Pixel>::type,
137 typename color_space_type<Pixel>::type