8 #ifndef BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_WRITER_HPP 9 #define BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_WRITER_HPP 11 #include <boost/gil/io/get_writer.hpp> 13 #include <boost/mpl/and.hpp> 15 #include <type_traits> 17 namespace boost {
namespace gil {
19 template <
typename String,
typename FormatTag>
21 auto make_dynamic_image_writer(
22 String
const& file_name, image_write_info<FormatTag>
const& info,
23 typename std::enable_if
27 detail::is_supported_path_spec<String>,
28 is_format_tag<FormatTag>
31 ->
typename get_dynamic_image_writer<String, FormatTag>::type
33 using deveice_t =
typename get_write_device<String, FormatTag>::type;
35 detail::convert_to_native_string(file_name),
36 typename detail::file_stream_device<FormatTag>::write_tag());
38 return typename get_dynamic_image_writer<String, FormatTag>::type(device, info);
41 template<
typename FormatTag >
43 typename get_dynamic_image_writer< std::wstring
46 make_dynamic_image_writer(
const std::wstring& file_name
47 ,
const image_write_info< FormatTag >& info
50 const char* str = detail::convert_to_native_string( file_name );
52 typename get_write_device< std::wstring
55 ,
typename detail::file_stream_device< FormatTag >::write_tag()
60 return typename get_dynamic_image_writer< std::wstring
67 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 68 template<
typename FormatTag >
70 typename get_dynamic_image_writer< std::wstring
73 make_dynamic_image_writer(
const filesystem::path& path
74 ,
const image_write_info< FormatTag >& info
77 return make_dynamic_image_writer( path.wstring()
81 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 83 template <
typename Device,
typename FormatTag>
85 auto make_dynamic_image_writer(Device& file, image_write_info<FormatTag>
const& info,
86 typename std::enable_if
90 typename detail::is_adaptable_output_device<FormatTag, Device>::type,
91 is_format_tag<FormatTag>
94 ->
typename get_dynamic_image_writer<Device, FormatTag>::type
96 typename get_write_device<Device, FormatTag>::type device(file);
97 return typename get_dynamic_image_writer<Device, FormatTag>::type(device, info);
102 template <
typename String,
typename FormatTag>
104 auto make_dynamic_image_writer(String
const& file_name, FormatTag
const&,
105 typename std::enable_if
109 detail::is_supported_path_spec<String>,
110 is_format_tag<FormatTag>
113 ->
typename get_dynamic_image_writer<String, FormatTag>::type
115 return make_dynamic_image_writer(file_name, image_write_info<FormatTag>());
118 template<
typename FormatTag >
120 typename get_dynamic_image_writer< std::wstring
123 make_dynamic_image_writer(
const std::wstring& file_name
127 return make_dynamic_image_writer( file_name
128 , image_write_info< FormatTag >()
132 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 133 template<
typename FormatTag >
135 typename get_dynamic_image_writer< std::wstring
138 make_dynamic_image_writer(
const filesystem::path& path
142 return make_dynamic_image_writer( path.wstring()
143 , image_write_info< FormatTag >()
146 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 149 template <
typename Device,
typename FormatTag>
151 auto make_dynamic_image_writer(Device& file, FormatTag
const&,
152 typename std::enable_if
156 typename detail::is_adaptable_output_device<FormatTag, Device>::type,
157 is_format_tag<FormatTag>
160 ->
typename get_dynamic_image_writer<Device, FormatTag>::type
162 return make_dynamic_image_writer(file, image_write_info<FormatTag>());
Definition: algorithm.hpp:30