changeset 1926:2a129de4b5e2

EnumerationToString for PixelFormat
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Mar 2016 09:53:41 +0100
parents 56276bad7e42
children b60f27664b8f
files Core/Enumerations.cpp Core/Enumerations.h
diffstat 2 files changed, 27 insertions(+), 0 deletions(-) [+]
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);
--- a/Core/Enumerations.h	Tue Mar 08 16:56:34 2016 +0100
+++ b/Core/Enumerations.h	Wed Mar 09 09:53:41 2016 +0100
@@ -444,6 +444,8 @@
 
   const char* EnumerationToString(RequestOrigin origin);
 
+  const char* EnumerationToString(PixelFormat format);
+
   Encoding StringToEncoding(const char* encoding);
 
   ResourceType StringToResourceType(const char* type);