diff Plugins/Engine/OrthancPlugins.cpp @ 1916:5bcf721bde4f

IImageWriter
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Feb 2016 15:26:37 +0100
parents d7c1cb559431
children e8c2f993f6b3
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp	Tue Feb 09 14:50:29 2016 +0100
+++ b/Plugins/Engine/OrthancPlugins.cpp	Tue Feb 09 15:26:37 2016 +0100
@@ -1328,12 +1328,15 @@
 
     std::string compressed;
 
+    ImageAccessor accessor;
+    accessor.AssignReadOnly(Plugins::Convert(p.pixelFormat), p.width, p.height, p.pitch, p.buffer);
+
     switch (p.imageFormat)
     {
       case OrthancPluginImageFormat_Png:
       {
         PngWriter writer;
-        writer.WriteToMemory(compressed, p.width, p.height, p.pitch, Plugins::Convert(p.pixelFormat), p.buffer);
+        writer.WriteToMemory(compressed, accessor);
         break;
       }
 
@@ -1341,7 +1344,7 @@
       {
         JpegWriter writer;
         writer.SetQuality(p.quality);
-        writer.WriteToMemory(compressed, p.width, p.height, p.pitch, Plugins::Convert(p.pixelFormat), p.buffer);
+        writer.WriteToMemory(compressed, accessor);
         break;
       }