diff Core/Enumerations.cpp @ 1926:2a129de4b5e2

EnumerationToString for PixelFormat
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Mar 2016 09:53:41 +0100
parents 5096681efce6
children d90f737f2dde
line wrap: on
line diff
--- a/Core/Enumerations.cpp	Tue Mar 08 16:56:34 2016 +0100
+++ b/Core/Enumerations.cpp	Wed Mar 09 09:53:41 2016 +0100
@@ -718,6 +718,31 @@
   }
 
 
+  const char* EnumerationToString(PixelFormat format)
+  {
+    switch (format)
+    {
+      case PixelFormat_RGB24:
+        return "RGB24";
+
+      case PixelFormat_RGBA32:
+        return "RGBA32";
+
+      case PixelFormat_Grayscale8:
+        return "Grayscale (unsigned 8bpp)";
+
+      case PixelFormat_Grayscale16:
+        return "Grayscale (unsigned 16bpp)";
+
+      case PixelFormat_SignedGrayscale16:
+        return "Grayscale (signed 16bpp)";
+
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
   Encoding StringToEncoding(const char* encoding)
   {
     std::string s(encoding);