diff Core/Images/ImageProcessing.cpp @ 2423:5a7c5c541a1d

Built-in decoding of palette images
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Oct 2017 21:58:08 +0200
parents 7e217a1cc63f
children 878b59270859
line wrap: on
line diff
--- a/Core/Images/ImageProcessing.cpp	Sun Oct 08 11:46:56 2017 +0200
+++ b/Core/Images/ImageProcessing.cpp	Mon Oct 09 21:58:08 2017 +0200
@@ -568,6 +568,26 @@
       return;
     }
 
+    if (target.GetFormat() == PixelFormat_RGB24 &&
+        source.GetFormat() == PixelFormat_RGB48)
+    {
+      for (unsigned int y = 0; y < source.GetHeight(); y++)
+      {
+        const uint16_t* p = reinterpret_cast<const uint16_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[0] >> 8;
+          q[1] = p[1] >> 8;
+          q[2] = p[2] >> 8;
+          p += 3;
+          q += 3;
+        }
+      }
+
+      return;
+    }
+
     throw OrthancException(ErrorCode_NotImplemented);
   }