2 // Copyright 2007-2012 Christian Henning, Andreas Pokorny, 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_IO_READ_IMAGE_INFO_HPP
9 #define BOOST_GIL_IO_READ_IMAGE_INFO_HPP
11 #include <boost/gil/io/base.hpp>
12 #include <boost/gil/io/device.hpp>
13 #include <boost/gil/io/get_reader.hpp>
14 #include <boost/gil/io/path_spec.hpp>
15 #include <boost/gil/detail/mp11.hpp>
17 #include <type_traits>
19 namespace boost{ namespace gil {
23 /// \brief Returns the image format backend. Backend is format specific.
24 /// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
25 /// \param settings Specifies read settings depending on the image format.
26 /// \return image_read_info object dependent on the image format.
27 /// \throw std::ios_base::failure
28 template <typename Device, typename FormatTag>
30 auto read_image_info(Device& file, image_read_settings<FormatTag> const& settings,
31 typename std::enable_if
35 detail::is_adaptable_input_device<FormatTag, Device>,
36 is_format_tag<FormatTag>
38 >::type* /*dummy*/ = nullptr)
39 -> typename get_reader_backend<Device, FormatTag>::type
41 return make_reader_backend(file, settings);
44 /// \brief Returns the image format backend. Backend is format specific.
45 /// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
46 /// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
47 /// \return image_read_info object dependent on the image format.
48 /// \throw std::ios_base::failure
49 template <typename Device, typename FormatTag>
51 auto read_image_info(Device& file, FormatTag const&,
52 typename std::enable_if
56 detail::is_adaptable_input_device<FormatTag, Device>,
57 is_format_tag<FormatTag>
59 >::type* /*dummy*/ = nullptr)
60 -> typename get_reader_backend<Device, FormatTag>::type
62 return read_image_info(file, image_read_settings<FormatTag>());
65 /// \brief Returns the image format backend. Backend is format specific.
66 /// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
67 /// \param settings Specifies read settings depending on the image format.
68 /// \return image_read_info object dependent on the image format.
69 /// \throw std::ios_base::failure
70 template <typename String, typename FormatTag>
73 String const& file_name, image_read_settings<FormatTag> const& settings,
74 typename std::enable_if
78 is_format_tag<FormatTag>,
79 detail::is_supported_path_spec<String>
81 >::type* /*dummy*/ = nullptr)
82 -> typename get_reader_backend<String, FormatTag>::type
84 return make_reader_backend(file_name, settings);
87 /// \brief Returns the image format backend. Backend is format specific.
88 /// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
89 /// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
90 /// \return image_read_info object dependent on the image format.
91 /// \throw std::ios_base::failure
92 template <typename String, typename FormatTag>
94 auto read_image_info(String const& file_name, FormatTag const&,
95 typename std::enable_if
99 is_format_tag<FormatTag>,
100 detail::is_supported_path_spec<String>
102 >::type* /*dummy*/ = nullptr)
103 -> typename get_reader_backend<String, FormatTag>::type
105 return read_image_info(file_name, image_read_settings<FormatTag>());
108 }} // namespace boost::gil