File indexing completed on 2025-01-18 09:36:58
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_GIL_EXTENSION_IO_PNM_DETAIL_IS_ALLOWED_HPP
0009 #define BOOST_GIL_EXTENSION_IO_PNM_DETAIL_IS_ALLOWED_HPP
0010
0011 #include <boost/gil/extension/io/pnm/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< pnm_tag >& info
0019 , std::true_type
0020 )
0021 {
0022 pnm_image_type::type asc_type = is_read_supported< typename get_pixel_type< View >::type
0023 , pnm_tag
0024 >::_asc_type;
0025
0026 pnm_image_type::type bin_type = is_read_supported< typename get_pixel_type< View >::type
0027 , pnm_tag
0028 >::_bin_type;
0029 if( info._type == pnm_image_type::mono_asc_t::value )
0030 {
0031
0032 return ( asc_type == pnm_image_type::gray_asc_t::value );
0033 }
0034
0035
0036 return ( asc_type == info._type
0037 || bin_type == info._type
0038 );
0039 }
0040
0041 template< typename View >
0042 bool is_allowed( const image_read_info< pnm_tag >&
0043 , std::false_type
0044 )
0045 {
0046 return true;
0047 }
0048
0049 }
0050 }
0051 }
0052
0053 #endif