2 // Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
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_JPEG_DETAIL_SUPPORTED_TYPES_HPP
9 #define BOOST_GIL_EXTENSION_IO_JPEG_DETAIL_SUPPORTED_TYPES_HPP
11 #include <boost/gil/extension/io/jpeg/tags.hpp>
13 #include <boost/gil/channel.hpp>
14 #include <boost/gil/color_base.hpp>
16 #include <type_traits>
18 namespace boost { namespace gil { namespace detail {
22 template< jpeg_color_space::type ColorSpace >
23 struct jpeg_rw_support_base
25 static const jpeg_color_space::type _color_space = ColorSpace;
28 template< typename Channel
31 struct jpeg_read_support : read_support_false
32 , jpeg_rw_support_base< JCS_UNKNOWN > {};
35 struct jpeg_read_support<uint8_t
38 , jpeg_rw_support_base< JCS_RGB > {};
41 struct jpeg_read_support<uint8_t
44 , jpeg_rw_support_base< JCS_CMYK > {};
47 struct jpeg_read_support<uint8_t
50 , jpeg_rw_support_base< JCS_GRAYSCALE > {};
54 template< typename Channel
57 struct jpeg_write_support : write_support_false
58 , jpeg_rw_support_base< JCS_UNKNOWN > {};
61 struct jpeg_write_support<uint8_t
63 > : write_support_true
64 , jpeg_rw_support_base< JCS_GRAYSCALE > {};
67 struct jpeg_write_support<uint8_t
69 > : write_support_true
70 , jpeg_rw_support_base< JCS_RGB > {};
73 struct jpeg_write_support<uint8_t
75 > : write_support_true
76 , jpeg_rw_support_base< JCS_CMYK > {};
80 template<typename Pixel>
81 struct is_read_supported<Pixel, jpeg_tag>
82 : std::integral_constant
85 detail::jpeg_read_support
87 typename channel_type<Pixel>::type,
88 typename color_space_type<Pixel>::type
92 using parent_t = detail::jpeg_read_support
94 typename channel_type<Pixel>::type,
95 typename color_space_type<Pixel>::type
98 static const typename jpeg_color_space::type _color_space = parent_t::_color_space;
101 template<typename Pixel>
102 struct is_write_supported<Pixel, jpeg_tag>
103 : std::integral_constant
106 detail::jpeg_write_support
108 typename channel_type<Pixel>::type,
109 typename color_space_type<Pixel>::type