8 #ifndef BOOST_GIL_IO_MAKE_WRITER_HPP
9 #define BOOST_GIL_IO_MAKE_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_writer(String
const& file_name, image_write_info<FormatTag>
const& info,
21 typename std::enable_if
25 detail::is_supported_path_spec<String>,
26 is_format_tag<FormatTag>
27 >::value>::type* =
nullptr)
28 ->
typename get_writer<String, FormatTag>::type
30 typename get_write_device<String, FormatTag>::type device(
31 detail::convert_to_native_string(file_name),
32 typename detail::file_stream_device<FormatTag>::write_tag());
34 return typename get_writer<String, FormatTag>::type(device, info);
37 template <
typename FormatTag>
39 auto make_writer(std::wstring
const& file_name, image_write_info<FormatTag>
const& info)
40 ->
typename get_writer<std::wstring, FormatTag>::type
42 const char* str = detail::convert_to_native_string( file_name );
44 typename get_write_device< std::wstring
47 ,
typename detail::file_stream_device< FormatTag >::write_tag()
52 return typename get_writer< std::wstring
59 template <
typename FormatTag>
61 auto make_writer(detail::filesystem::path
const& path, image_write_info<FormatTag>
const& info)
62 ->
typename get_writer<std::wstring, FormatTag>::type
64 return make_writer(path.wstring(), info);
67 template <
typename Device,
typename FormatTag>
69 auto make_writer(Device& file, image_write_info<FormatTag>
const& info,
70 typename std::enable_if
74 typename detail::is_adaptable_output_device<FormatTag, Device>::type,
75 is_format_tag<FormatTag>
78 ->
typename get_writer<Device, FormatTag>::type
80 typename get_write_device<Device, FormatTag>::type device(file);
81 return typename get_writer<Device, FormatTag>::type(device, info);
86 template <
typename String,
typename FormatTag>
88 auto make_writer(String
const& file_name, FormatTag
const&,
89 typename std::enable_if
93 detail::is_supported_path_spec<String>,
94 is_format_tag<FormatTag>
97 ->
typename get_writer<String, FormatTag>::type
99 return make_writer(file_name, image_write_info<FormatTag>());
102 template <
typename FormatTag>
104 auto make_writer(std::wstring
const &file_name, FormatTag
const&)
105 ->
typename get_writer<std::wstring, FormatTag>::type
107 return make_writer( file_name
108 , image_write_info< FormatTag >()
112 template <
typename FormatTag>
114 auto make_writer(detail::filesystem::path
const& path, FormatTag
const& tag)
115 ->
typename get_writer<std::wstring, FormatTag>::type
117 return make_writer(path.wstring(), tag);
120 template <
typename Device,
typename FormatTag>
122 auto make_writer(Device& file, FormatTag
const&,
123 typename std::enable_if
127 typename detail::is_adaptable_output_device<FormatTag, Device>::type,
128 is_format_tag<FormatTag>
131 ->
typename get_writer<Device, FormatTag>::type
133 return make_writer(file, image_write_info<FormatTag>());
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36