diff Core/Images/PngWriter.cpp @ 1916:5bcf721bde4f

IImageWriter
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Feb 2016 15:26:37 +0100
parents b1291df2f780
children 08ce34cfacad
line wrap: on
line diff
--- a/Core/Images/PngWriter.cpp	Tue Feb 09 14:50:29 2016 +0100
+++ b/Core/Images/PngWriter.cpp	Tue Feb 09 15:26:37 2016 +0100
@@ -202,16 +202,17 @@
   }
 
 
-  void PngWriter::WriteToFile(const char* filename,
-                              unsigned int width,
-                              unsigned int height,
-                              unsigned int pitch,
-                              PixelFormat format,
-                              const void* buffer)
+  void PngWriter::WriteToFileInternal(const std::string& filename,
+                                      unsigned int width,
+                                      unsigned int height,
+                                      unsigned int pitch,
+                                      PixelFormat format,
+                                      const void* buffer)
   {
     Prepare(width, height, pitch, format, buffer);
 
-    FILE* fp = fopen(filename, "wb");
+    // TODO This will not work on Windows system if the path contains non-ASCII characters
+    FILE* fp = fopen(filename.c_str(), "wb");
     if (!fp)
     {
       throw OrthancException(ErrorCode_CannotWriteFile);
@@ -232,7 +233,6 @@
 
 
 
-
   static void MemoryCallback(png_structp png_ptr, 
                              png_bytep data, 
                              png_size_t size)
@@ -243,12 +243,12 @@
 
 
 
-  void PngWriter::WriteToMemory(std::string& png,
-                                unsigned int width,
-                                unsigned int height,
-                                unsigned int pitch,
-                                PixelFormat format,
-                                const void* buffer)
+  void PngWriter::WriteToMemoryInternal(std::string& png,
+                                        unsigned int width,
+                                        unsigned int height,
+                                        unsigned int pitch,
+                                        PixelFormat format,
+                                        const void* buffer)
   {
     ChunkedBuffer chunks;