8 #ifndef BOOST_GIL_IO_READ_VIEW_HPP 9 #define BOOST_GIL_IO_READ_VIEW_HPP 11 #include <boost/gil/io/base.hpp> 12 #include <boost/gil/io/conversion_policies.hpp> 13 #include <boost/gil/io/device.hpp> 14 #include <boost/gil/io/get_reader.hpp> 15 #include <boost/gil/io/path_spec.hpp> 16 #include <boost/gil/detail/mp11.hpp> 18 #include <type_traits> 20 namespace boost {
namespace gil {
29 template <
typename Reader,
typename View>
32 typename std::enable_if
36 detail::is_reader<Reader>,
37 typename is_format_tag<typename Reader::format_tag_t>::type,
40 typename get_pixel_type<View>::type,
41 typename Reader::format_tag_t
46 reader.check_image_size(
view.dimensions());
47 reader.init_view(
view, reader._settings);
56 template <
typename Device,
typename View,
typename FormatTag>
61 image_read_settings<FormatTag>
const& settings,
62 typename std::enable_if
66 detail::is_read_device<FormatTag, Device>,
67 typename is_format_tag<FormatTag>::type,
68 typename is_read_supported
70 typename get_pixel_type<View>::type,
77 typename get_reader<Device, FormatTag, detail::read_and_no_convert>::type;
79 reader_t reader = make_reader(file, settings, detail::read_and_no_convert());
88 template <
typename Device,
typename View,
typename FormatTag>
90 void read_view(Device& file, View
const&
view, FormatTag
const& tag,
91 typename std::enable_if
95 typename is_format_tag<FormatTag>::type,
96 detail::is_read_device<FormatTag, Device>,
97 typename is_read_supported
99 typename get_pixel_type<View>::type,
102 >::value>::type* =
nullptr)
105 typename get_reader<Device, FormatTag, detail::read_and_no_convert>::type;
107 reader_t reader = make_reader(file, tag, detail::read_and_no_convert());
116 template <
typename String,
typename View,
typename FormatTag>
119 String
const& file_name,
121 image_read_settings<FormatTag>
const& settings,
122 typename std::enable_if
126 typename detail::is_supported_path_spec<String>::type,
127 typename is_format_tag<FormatTag>::type,
128 typename is_read_supported
130 typename get_pixel_type<View>::type,
137 typename get_reader<String, FormatTag, detail::read_and_no_convert>::type;
139 reader_t reader = make_reader(file_name, settings, detail::read_and_no_convert());
148 template <
typename String,
typename View,
typename FormatTag>
150 void read_view(String
const& file_name, View
const&
view, FormatTag
const& tag,
151 typename std::enable_if
155 typename detail::is_supported_path_spec<String>::type,
156 typename is_format_tag<FormatTag>::type,
157 typename is_read_supported
159 typename get_pixel_type<View>::type,
166 typename get_reader<String, FormatTag, detail::read_and_no_convert>::type;
168 reader_t reader = make_reader(file_name, tag, detail::read_and_no_convert());
void read_view(Reader reader, View const &view, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, typename is_format_tag< typename Reader::format_tag_t >::type, typename is_read_supported< typename get_pixel_type< View >::type, typename Reader::format_tag_t >::type >::value >::type *=nullptr)
Reads an image view without conversion. No memory is allocated.
Definition: read_view.hpp:31
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:535