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

IImageWriter
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Feb 2016 15:26:37 +0100
parents 7454019be8f3
children baf8dd89b4e0
line wrap: on
line diff
--- a/Core/Images/PngWriter.h	Tue Feb 09 14:50:29 2016 +0100
+++ b/Core/Images/PngWriter.h	Tue Feb 09 15:26:37 2016 +0100
@@ -32,16 +32,29 @@
 
 #pragma once
 
-#include "ImageAccessor.h"
+#include "IImageWriter.h"
 
-#include <boost/noncopyable.hpp>
 #include <boost/shared_ptr.hpp>
-#include <string>
 
 namespace Orthanc
 {
-  class PngWriter : public boost::noncopyable
+  class PngWriter : public IImageWriter
   {
+  protected:
+    virtual void WriteToFileInternal(const std::string& filename,
+                                     unsigned int width,
+                                     unsigned int height,
+                                     unsigned int pitch,
+                                     PixelFormat format,
+                                     const void* buffer);
+
+    virtual void WriteToMemoryInternal(std::string& png,
+                                       unsigned int width,
+                                       unsigned int height,
+                                       unsigned int pitch,
+                                       PixelFormat format,
+                                       const void* buffer);
+
   private:
     struct PImpl;
     boost::shared_ptr<PImpl> pimpl_;
@@ -61,33 +74,5 @@
     PngWriter();
 
     ~PngWriter();
-
-    void WriteToFile(const char* filename,
-                     unsigned int width,
-                     unsigned int height,
-                     unsigned int pitch,
-                     PixelFormat format,
-                     const void* buffer);
-
-    void WriteToMemory(std::string& png,
-                       unsigned int width,
-                       unsigned int height,
-                       unsigned int pitch,
-                       PixelFormat format,
-                       const void* buffer);
-
-    void WriteToFile(const char* filename,
-                     const ImageAccessor& accessor)
-    {
-      WriteToFile(filename, accessor.GetWidth(), accessor.GetHeight(),
-                  accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer());
-    }
-
-    void WriteToMemory(std::string& png,
-                       const ImageAccessor& accessor)
-    {
-      WriteToMemory(png, accessor.GetWidth(), accessor.GetHeight(),
-                    accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer());
-    }
   };
 }