Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:37:03

0001 //
0002 // Copyright 2007-2012 Christian Henning, Andreas Pokorny, 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_IO_READ_IMAGE_INFO_HPP
0009 #define BOOST_GIL_IO_READ_IMAGE_INFO_HPP
0010 
0011 #include <boost/gil/io/base.hpp>
0012 #include <boost/gil/io/device.hpp>
0013 #include <boost/gil/io/get_reader.hpp>
0014 #include <boost/gil/io/path_spec.hpp>
0015 #include <boost/gil/detail/mp11.hpp>
0016 
0017 #include <type_traits>
0018 
0019 namespace boost{ namespace gil {
0020 
0021 /// \ingroup IO
0022 
0023 /// \brief Returns the image format backend. Backend is format specific.
0024 /// \param file      It's a device. Must satisfy is_adaptable_input_device metafunction.
0025 /// \param settings  Specifies read settings depending on the image format.
0026 /// \return image_read_info object dependent on the image format.
0027 /// \throw std::ios_base::failure
0028 template <typename Device, typename FormatTag>
0029 inline
0030 auto read_image_info(Device& file, image_read_settings<FormatTag> const& settings,
0031     typename std::enable_if
0032     <
0033         mp11::mp_and
0034         <
0035             detail::is_adaptable_input_device<FormatTag, Device>,
0036             is_format_tag<FormatTag>
0037         >::value
0038     >::type* /*dummy*/ = nullptr)
0039     -> typename get_reader_backend<Device, FormatTag>::type
0040 {
0041     return make_reader_backend(file, settings);
0042 }
0043 
0044 /// \brief Returns the image format backend. Backend is format specific.
0045 /// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
0046 /// \param tag  Defines the image format. Must satisfy is_format_tag metafunction.
0047 /// \return image_read_info object dependent on the image format.
0048 /// \throw std::ios_base::failure
0049 template <typename Device, typename FormatTag>
0050 inline
0051 auto read_image_info(Device& file, FormatTag const&,
0052     typename std::enable_if
0053     <
0054         mp11::mp_and
0055         <
0056             detail::is_adaptable_input_device<FormatTag, Device>,
0057             is_format_tag<FormatTag>
0058         >::value
0059     >::type* /*dummy*/ = nullptr)
0060     -> typename get_reader_backend<Device, FormatTag>::type
0061 {
0062     return read_image_info(file, image_read_settings<FormatTag>());
0063 }
0064 
0065 /// \brief Returns the image format backend. Backend is format specific.
0066 /// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
0067 /// \param settings  Specifies read settings depending on the image format.
0068 /// \return image_read_info object dependent on the image format.
0069 /// \throw std::ios_base::failure
0070 template <typename String, typename FormatTag>
0071 inline
0072 auto read_image_info(
0073     String const& file_name, image_read_settings<FormatTag> const& settings,
0074     typename std::enable_if
0075     <
0076         mp11::mp_and
0077         <
0078             is_format_tag<FormatTag>,
0079             detail::is_supported_path_spec<String>
0080         >::value
0081     >::type* /*dummy*/ = nullptr)
0082     -> typename get_reader_backend<String, FormatTag>::type
0083 {
0084     return make_reader_backend(file_name, settings);
0085 }
0086 
0087 /// \brief Returns the image format backend. Backend is format specific.
0088 /// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
0089 /// \param tag       Defines the image format. Must satisfy is_format_tag metafunction.
0090 /// \return image_read_info object dependent on the image format.
0091 /// \throw std::ios_base::failure
0092 template <typename String, typename FormatTag>
0093 inline
0094 auto read_image_info(String const& file_name, FormatTag const&,
0095     typename std::enable_if
0096     <
0097         mp11::mp_and
0098         <
0099             is_format_tag<FormatTag>,
0100             detail::is_supported_path_spec<String>
0101         >::value
0102     >::type* /*dummy*/ = nullptr)
0103     -> typename get_reader_backend<String, FormatTag>::type
0104 {
0105     return read_image_info(file_name, image_read_settings<FormatTag>());
0106 }
0107 
0108 }} // namespace boost::gil
0109 
0110 #endif