8 #ifndef BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_WRITER_HPP
9 #define BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_WRITER_HPP
11 #include <boost/gil/detail/mp11.hpp>
12 #include <boost/gil/io/get_writer.hpp>
14 #include <type_traits>
16 namespace boost {
namespace gil {
18 template <
typename String,
typename FormatTag>
20 auto make_dynamic_image_writer(
21 String
const& file_name, image_write_info<FormatTag>
const& info,
22 typename std::enable_if
26 detail::is_supported_path_spec<String>,
27 is_format_tag<FormatTag>
30 ->
typename get_dynamic_image_writer<String, FormatTag>::type
32 using deveice_t =
typename get_write_device<String, FormatTag>::type;
34 detail::convert_to_native_string(file_name),
35 typename detail::file_stream_device<FormatTag>::write_tag());
37 return typename get_dynamic_image_writer<String, FormatTag>::type(device, info);
40 template<
typename FormatTag >
42 auto make_dynamic_image_writer(std::wstring
const& file_name, image_write_info<FormatTag>
const& info)
43 ->
typename get_dynamic_image_writer< std::wstring, FormatTag>::type
45 const char* str = detail::convert_to_native_string( file_name );
47 typename get_write_device< std::wstring
50 ,
typename detail::file_stream_device< FormatTag >::write_tag()
55 return typename get_dynamic_image_writer< std::wstring
62 template <
typename FormatTag>
64 auto make_dynamic_image_writer(detail::filesystem::path
const& path, image_write_info<FormatTag>
const& info)
65 ->
typename get_dynamic_image_writer<std::wstring, FormatTag>::type
67 return make_dynamic_image_writer(path.wstring(), info);
70 template <
typename Device,
typename FormatTag>
72 auto make_dynamic_image_writer(Device& file, image_write_info<FormatTag>
const& info,
73 typename std::enable_if
77 typename detail::is_adaptable_output_device<FormatTag, Device>::type,
78 is_format_tag<FormatTag>
81 ->
typename get_dynamic_image_writer<Device, FormatTag>::type
83 typename get_write_device<Device, FormatTag>::type device(file);
84 return typename get_dynamic_image_writer<Device, FormatTag>::type(device, info);
89 template <
typename String,
typename FormatTag>
91 auto make_dynamic_image_writer(String
const& file_name, FormatTag
const&,
92 typename std::enable_if
96 detail::is_supported_path_spec<String>,
97 is_format_tag<FormatTag>
100 ->
typename get_dynamic_image_writer<String, FormatTag>::type
102 return make_dynamic_image_writer(file_name, image_write_info<FormatTag>());
105 template <
typename FormatTag>
107 auto make_dynamic_image_writer(std::wstring
const& file_name, FormatTag
const&)
108 ->
typename get_dynamic_image_writer<std::wstring, FormatTag>::type
110 return make_dynamic_image_writer( file_name
111 , image_write_info< FormatTag >()
115 template <
typename FormatTag>
117 auto make_dynamic_image_writer(detail::filesystem::path
const& path, FormatTag
const&)
118 ->
typename get_dynamic_image_writer<std::wstring, FormatTag>::type
120 return make_dynamic_image_writer(path.wstring(), image_write_info<FormatTag>());
123 template <
typename Device,
typename FormatTag>
125 auto make_dynamic_image_writer(Device& file, FormatTag
const&,
126 typename std::enable_if
130 typename detail::is_adaptable_output_device<FormatTag, Device>::type,
131 is_format_tag<FormatTag>
134 ->
typename get_dynamic_image_writer<Device, FormatTag>::type
136 return make_dynamic_image_writer(file, image_write_info<FormatTag>());
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36