Boost GIL


read_image_info.hpp
1 //
2 // Copyright 2007-2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
3 //
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
7 //
8 #ifndef BOOST_GIL_IO_READ_IMAGE_INFO_HPP
9 #define BOOST_GIL_IO_READ_IMAGE_INFO_HPP
10 
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>
16 
17 #include <type_traits>
18 
19 namespace boost{ namespace gil {
20 
22 
28 template <typename Device, typename FormatTag>
29 inline
30 auto read_image_info(Device& file, image_read_settings<FormatTag> const& settings,
31  typename std::enable_if
32  <
33  mp11::mp_and
34  <
35  detail::is_adaptable_input_device<FormatTag, Device>,
36  is_format_tag<FormatTag>
37  >::value
38  >::type* /*dummy*/ = nullptr)
40 {
41  return make_reader_backend(file, settings);
42 }
43 
49 template <typename Device, typename FormatTag>
50 inline
51 auto read_image_info(Device& file, FormatTag const&,
52  typename std::enable_if
53  <
54  mp11::mp_and
55  <
56  detail::is_adaptable_input_device<FormatTag, Device>,
57  is_format_tag<FormatTag>
58  >::value
59  >::type* /*dummy*/ = nullptr)
60  -> typename get_reader_backend<Device, FormatTag>::type
61 {
62  return read_image_info(file, image_read_settings<FormatTag>());
63 }
64 
70 template <typename String, typename FormatTag>
71 inline
72 auto read_image_info(
73  String const& file_name, image_read_settings<FormatTag> const& settings,
74  typename std::enable_if
75  <
76  mp11::mp_and
77  <
78  is_format_tag<FormatTag>,
79  detail::is_supported_path_spec<String>
80  >::value
81  >::type* /*dummy*/ = nullptr)
82  -> typename get_reader_backend<String, FormatTag>::type
83 {
84  return make_reader_backend(file_name, settings);
85 }
86 
92 template <typename String, typename FormatTag>
93 inline
94 auto read_image_info(String const& file_name, FormatTag const&,
95  typename std::enable_if
96  <
97  mp11::mp_and
98  <
99  is_format_tag<FormatTag>,
100  detail::is_supported_path_spec<String>
101  >::value
102  >::type* /*dummy*/ = nullptr)
103  -> typename get_reader_backend<String, FormatTag>::type
104 {
105  return read_image_info(file_name, image_read_settings<FormatTag>());
106 }
107 
108 }} // namespace boost::gil
109 
110 #endif
auto read_image_info(Device &file, image_read_settings< FormatTag > const &settings, typename std::enable_if< mp11::mp_and< detail::is_adaptable_input_device< FormatTag, Device >, is_format_tag< FormatTag > >::value >::type *=nullptr) -> typename get_reader_backend< Device, FormatTag >::type
Returns the image format backend. Backend is format specific.
Definition: read_image_info.hpp:30
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36
Helper metafunction to generate image backend type.
Definition: get_reader.hpp:115