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 typename get_dynamic_image_writer< std::wstring
    45 make_dynamic_image_writer( 
const std::wstring&                  file_name
    46                          , 
const image_write_info< FormatTag >& info
    49     const char* str = detail::convert_to_native_string( file_name );
    51     typename get_write_device< std::wstring
    54                                   , 
typename detail::file_stream_device< FormatTag >::write_tag()
    59     return typename get_dynamic_image_writer< std::wstring
    66 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    67 template< 
typename FormatTag >
    69 typename get_dynamic_image_writer< std::wstring
    72 make_dynamic_image_writer( 
const filesystem::path&              path
    73                          , 
const image_write_info< FormatTag >& info
    76     return make_dynamic_image_writer( path.wstring()
    80 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    82 template <
typename Device, 
typename FormatTag>
    84 auto make_dynamic_image_writer(Device& file, image_write_info<FormatTag> 
const& info,
    85     typename std::enable_if
    89             typename detail::is_adaptable_output_device<FormatTag, Device>::type,
    90             is_format_tag<FormatTag>
    93     -> 
typename get_dynamic_image_writer<Device, FormatTag>::type
    95     typename get_write_device<Device, FormatTag>::type device(file);
    96     return typename get_dynamic_image_writer<Device, FormatTag>::type(device, info);
   101 template <
typename String, 
typename FormatTag>
   103 auto make_dynamic_image_writer(String 
const& file_name, FormatTag 
const&,
   104     typename std::enable_if
   108             detail::is_supported_path_spec<String>,
   109             is_format_tag<FormatTag>
   112     -> 
typename get_dynamic_image_writer<String, FormatTag>::type
   114     return make_dynamic_image_writer(file_name, image_write_info<FormatTag>());
   117 template< 
typename FormatTag >
   119 typename get_dynamic_image_writer< std::wstring
   122 make_dynamic_image_writer( 
const std::wstring& file_name
   126     return make_dynamic_image_writer( file_name
   127                                     , image_write_info< FormatTag >()
   131 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT   132 template< 
typename FormatTag >
   134 typename get_dynamic_image_writer< std::wstring
   137 make_dynamic_image_writer( 
const filesystem::path& path
   141     return make_dynamic_image_writer( path.wstring()
   142                                     , image_write_info< FormatTag >()
   145 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT   148 template <
typename Device, 
typename FormatTag>
   150 auto make_dynamic_image_writer(Device& file, FormatTag 
const&,
   151     typename std::enable_if
   155             typename detail::is_adaptable_output_device<FormatTag, Device>::type,
   156             is_format_tag<FormatTag>
   159     -> 
typename get_dynamic_image_writer<Device, FormatTag>::type
   161     return make_dynamic_image_writer(file, image_write_info<FormatTag>());