Back to home page

EIC code displayed by LXR

 
 

    


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

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_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   // is read_and_no_convert
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         // ascii mono images are read gray8_image_t
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 >& /* info */
0043                , std::false_type  // is read_and_convert
0044                )
0045 {
0046     return true;
0047 }
0048 
0049 } // namespace detail
0050 } // namespace gil
0051 } // namespace boost
0052 
0053 #endif