2 // Copyright 2009 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_PNM_DETAIL_IS_ALLOWED_HPP
9 #define BOOST_GIL_EXTENSION_IO_PNM_DETAIL_IS_ALLOWED_HPP
11 #include <boost/gil/extension/io/pnm/tags.hpp>
13 #include <type_traits>
15 namespace boost { namespace gil { namespace detail {
17 template< typename View >
18 bool is_allowed( const image_read_info< pnm_tag >& info
19 , std::true_type // is read_and_no_convert
22 pnm_image_type::type asc_type = is_read_supported< typename get_pixel_type< View >::type
26 pnm_image_type::type bin_type = is_read_supported< typename get_pixel_type< View >::type
29 if( info._type == pnm_image_type::mono_asc_t::value )
31 // ascii mono images are read gray8_image_t
32 return ( asc_type == pnm_image_type::gray_asc_t::value );
36 return ( asc_type == info._type
37 || bin_type == info._type
41 template< typename View >
42 bool is_allowed( const image_read_info< pnm_tag >& /* info */
43 , std::false_type // is read_and_convert