2 // Copyright 2008 Christian Henning, Lubomir Bourdev
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_PNG_DETAIL_IS_ALLOWED_HPP
9 #define BOOST_GIL_EXTENSION_IO_PNG_DETAIL_IS_ALLOWED_HPP
11 #include <boost/gil/extension/io/png/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< png_tag >& info
19 , std::true_type // is read_and_no_convert
22 using pixel_t = typename get_pixel_type<View>::type;
24 using channel_t = typename channel_traits<typename element_type<pixel_t>::type>::value_type;
26 const png_num_channels::type dst_num_channels = num_channels< pixel_t >::value;
27 const png_bitdepth::type dst_bit_depth = detail::unsigned_integral_num_bits< channel_t >::value;
29 return dst_num_channels == info._num_channels
30 && dst_bit_depth == info._bit_depth;
33 template< typename View >
34 bool is_allowed( const image_read_info< png_tag >& /* info */
35 , std::false_type // is read_and_convert