8 #ifndef BOOST_GIL_IO_READ_AND_CONVERT_VIEW_HPP 9 #define BOOST_GIL_IO_READ_AND_CONVERT_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 {
30 template <
typename Reader,
typename View>
33 typename std::enable_if
37 detail::is_reader<Reader>,
38 is_format_tag<typename Reader::format_tag_t>
42 reader.check_image_size(
view.dimensions());
43 reader.init_view(
view, reader._settings);
53 template <
typename Device,
typename View,
typename ColorConverter,
typename FormatTag>
58 image_read_settings<FormatTag>
const& settings,
59 ColorConverter
const& cc,
60 typename std::enable_if
64 detail::is_read_device<FormatTag, Device>,
65 is_format_tag<FormatTag>
69 using read_and_convert_t = detail::read_and_convert<ColorConverter>;
70 using reader_t =
typename get_reader<Device, FormatTag, read_and_convert_t>::type;
72 reader_t reader = make_reader(device, settings, read_and_convert_t{cc});
82 template <
typename String,
typename View,
typename ColorConverter,
typename FormatTag>
85 String
const& file_name,
87 image_read_settings<FormatTag>
const& settings,
88 ColorConverter
const& cc,
89 typename std::enable_if
93 is_format_tag<FormatTag>,
94 detail::is_supported_path_spec<String>
98 using read_and_convert_t = detail::read_and_convert<ColorConverter>;
99 using reader_t =
typename get_reader<String, FormatTag, read_and_convert_t>::type;
101 reader_t reader = make_reader(file_name, settings, read_and_convert_t{cc});
111 template <
typename String,
typename View,
typename ColorConverter,
typename FormatTag>
114 String
const& file_name,
116 ColorConverter
const& cc,
117 FormatTag
const& tag,
118 typename std::enable_if
122 is_format_tag<FormatTag>,
123 detail::is_supported_path_spec<String>
127 using read_and_convert_t = detail::read_and_convert<ColorConverter>;
128 using reader_t =
typename get_reader<String, FormatTag, read_and_convert_t>::type;
130 reader_t reader = make_reader(file_name, tag, read_and_convert_t{cc});
140 template <
typename Device,
typename View,
typename ColorConverter,
typename FormatTag>
145 ColorConverter
const& cc,
146 FormatTag
const& tag,
147 typename std::enable_if
151 detail::is_read_device<FormatTag, Device>,
152 is_format_tag<FormatTag>
156 using read_and_convert_t = detail::read_and_convert<ColorConverter>;
157 using reader_t =
typename get_reader<Device, FormatTag, read_and_convert_t>::type;
159 reader_t reader = make_reader(device, tag, read_and_convert_t{cc});
168 template <
typename String,
typename View,
typename FormatTag>
171 String
const& file_name,
173 image_read_settings<FormatTag>
const& settings,
174 typename std::enable_if
178 is_format_tag<FormatTag>,
179 detail::is_supported_path_spec<String>
183 using read_and_convert_t = detail::read_and_convert<default_color_converter>;
184 using reader_t =
typename get_reader<String, FormatTag, read_and_convert_t>::type;
186 reader_t reader = make_reader(file_name, settings, read_and_convert_t{});
195 template <
typename Device,
typename View,
typename FormatTag>
200 image_read_settings<FormatTag>
const& settings,
201 typename std::enable_if
205 detail::is_read_device<FormatTag, Device>,
206 is_format_tag<FormatTag>
210 using read_and_convert_t = detail::read_and_convert<default_color_converter>;
211 using reader_t =
typename get_reader<Device, FormatTag, read_and_convert_t>::type;
213 reader_t reader = make_reader(device, settings, read_and_convert_t{});
222 template <
typename String,
typename View,
typename FormatTag>
225 String
const& file_name,
227 FormatTag
const& tag,
228 typename std::enable_if
232 is_format_tag<FormatTag>,
233 detail::is_supported_path_spec<String>
237 using read_and_convert_t = detail::read_and_convert<default_color_converter>;
238 using reader_t =
typename get_reader<String, FormatTag, read_and_convert_t>::type;
240 reader_t reader = make_reader(file_name, tag, read_and_convert_t{});
249 template <
typename Device,
typename View,
typename FormatTag>
254 FormatTag
const& tag,
255 typename std::enable_if
259 detail::is_read_device<FormatTag, Device>,
260 is_format_tag<FormatTag>
264 using read_and_convert_t = detail::read_and_convert<default_color_converter>;
265 using reader_t =
typename get_reader<Device, FormatTag, read_and_convert_t>::type;
267 reader_t reader = make_reader(device, tag, read_and_convert_t{});
void read_and_convert_view(Reader &reader, View const &view, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t > >::value >::type *=nullptr)
Reads and color-converts an image view. No memory is allocated.
Definition: read_and_convert_view.hpp:32
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