diff Resources/Orthanc/Core/Images/ImageProcessing.cpp @ 42:81e2651dca17

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Apr 2017 12:03:25 +0200
parents 7207a407bcd8
children
line wrap: on
line diff
--- a/Resources/Orthanc/Core/Images/ImageProcessing.cpp	Wed Mar 22 15:57:24 2017 +0100
+++ b/Resources/Orthanc/Core/Images/ImageProcessing.cpp	Fri Apr 14 12:03:25 2017 +0200
@@ -458,6 +458,26 @@
       return;
     }
 
+    if (target.GetFormat() == PixelFormat_RGB24 &&
+        source.GetFormat() == PixelFormat_BGRA32)
+    {
+      for (unsigned int y = 0; y < source.GetHeight(); y++)
+      {
+        const uint8_t* p = reinterpret_cast<const uint8_t*>(source.GetConstRow(y));
+        uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y));
+        for (unsigned int x = 0; x < source.GetWidth(); x++)
+        {
+          q[0] = p[2];
+          q[1] = p[1];
+          q[2] = p[0];
+          p += 4;
+          q += 3;
+        }
+      }
+
+      return;
+    }
+
     if (target.GetFormat() == PixelFormat_RGBA32 &&
         source.GetFormat() == PixelFormat_RGB24)
     {