diff Core/Images/Font.cpp @ 2853:52b017d22a4f

New URI: "/studies/.../merge" to merge a study
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Oct 2018 17:05:07 +0200
parents 878b59270859
children 668d5ad73c74
line wrap: on
line diff
--- a/Core/Images/Font.cpp	Mon Oct 01 14:19:45 2018 +0200
+++ b/Core/Images/Font.cpp	Tue Oct 02 17:05:07 2018 +0200
@@ -219,6 +219,7 @@
         }
 
         case PixelFormat_RGBA32:
+        case PixelFormat_BGRA32:
         {
           assert(bpp == 4);
 
@@ -256,7 +257,8 @@
   {
     if (target.GetFormat() != PixelFormat_Grayscale8 &&
         target.GetFormat() != PixelFormat_RGB24 &&
-        target.GetFormat() != PixelFormat_RGBA32)
+        target.GetFormat() != PixelFormat_RGBA32 &&
+        target.GetFormat() != PixelFormat_BGRA32)
     {
       throw OrthancException(ErrorCode_NotImplemented);
     }
@@ -311,7 +313,25 @@
                   uint8_t g,
                   uint8_t b) const
   {
-    uint8_t color[4] = { r, g, b, 255 };
+    uint8_t color[4];
+
+    switch (target.GetFormat())
+    {
+      case PixelFormat_BGRA32:
+        color[0] = b;
+        color[1] = g;
+        color[2] = r;
+        color[3] = 255;
+        break;
+
+      default:
+        color[0] = r;
+        color[1] = g;
+        color[2] = b;
+        color[3] = 255;
+        break;
+    }
+    
     DrawInternal(target, utf8, x, y, color);
   }