File indexing completed on 2025-01-18 09:36:57
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_GIL_EXTENSION_IO_PNG_DETAIL_IS_ALLOWED_HPP
0009 #define BOOST_GIL_EXTENSION_IO_PNG_DETAIL_IS_ALLOWED_HPP
0010
0011 #include <boost/gil/extension/io/png/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< png_tag >& info
0019 , std::true_type
0020 )
0021 {
0022 using pixel_t = typename get_pixel_type<View>::type;
0023
0024 using channel_t = typename channel_traits<typename element_type<pixel_t>::type>::value_type;
0025
0026 const png_num_channels::type dst_num_channels = num_channels< pixel_t >::value;
0027 const png_bitdepth::type dst_bit_depth = detail::unsigned_integral_num_bits< channel_t >::value;
0028
0029 return dst_num_channels == info._num_channels
0030 && dst_bit_depth == info._bit_depth;
0031 }
0032
0033 template< typename View >
0034 bool is_allowed( const image_read_info< png_tag >&
0035 , std::false_type
0036 )
0037 {
0038 return true;
0039 }
0040
0041 }
0042 }
0043 }
0044
0045 #endif