Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:56

0001 //
0002 // Copyright 2009 Christian Henning
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 #ifndef BOOST_GIL_EXTENSION_IO_JPEG_DETAIL_IS_ALLOWED_HPP
0009 #define BOOST_GIL_EXTENSION_IO_JPEG_DETAIL_IS_ALLOWED_HPP
0010 
0011 #include <boost/gil/extension/io/jpeg/tags.hpp>
0012 
0013 #include <type_traits>
0014 
0015 namespace boost { namespace gil { namespace detail {
0016 
0017 template< typename View >
0018 bool is_allowed( const image_read_info< jpeg_tag >& info
0019                , std::true_type   // is read_and_no_convert
0020                )
0021 {
0022     if( info._color_space == JCS_YCbCr )
0023     {
0024         // We read JCS_YCbCr files as rgb.
0025         return ( is_read_supported< typename View::value_type
0026                                   , jpeg_tag
0027                                   >::_color_space == JCS_RGB );
0028     }
0029 
0030     return ( is_read_supported< typename View::value_type
0031                               , jpeg_tag
0032                               >::_color_space == info._color_space );
0033 }
0034 
0035 template< typename View >
0036 bool is_allowed( const image_read_info< jpeg_tag >& /* info */
0037                , std::false_type  // is read_and_convert
0038                )
0039 {
0040     return true;
0041 }
0042 
0043 } // namespace detail
0044 } // namespace gil
0045 } // namespace boost
0046 
0047 #endif