Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //
0002 // Copyright 2008 Christian Henning, Lubomir Bourdev
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_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   // is read_and_no_convert
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 >& /* info */
0035                , std::false_type  // is read_and_convert
0036                )
0037 {
0038     return true;
0039 }
0040 
0041 } // namespace detail
0042 } // namespace gil
0043 } // namespace boost
0044 
0045 #endif