[gimp] libgimpcolor: handle palette formats in gimp_color_profile_get_format()



commit 52af9145d7c7556a35427545212a06195f51b8cb
Author: Michael Natterer <mitch gimp org>
Date:   Wed Apr 27 00:48:23 2016 +0200

    libgimpcolor: handle palette formats in gimp_color_profile_get_format()
    
    Return "R'G'B'[A] u8" and "TYPE_RGB[A]_8" and babl and lcms formats.
    
    I'm not sure which code triggered the warning about an unhandled
    format, but now it handles indexed images too.

 libgimpcolor/gimpcolorprofile.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c
index 39a25ab..05c2e68 100644
--- a/libgimpcolor/gimpcolorprofile.c
+++ b/libgimpcolor/gimpcolorprofile.c
@@ -1482,6 +1482,21 @@ gimp_color_profile_get_format (const Babl *format,
       gray   = TRUE;
       linear = FALSE;
     }
+  else if (babl_format_is_palette (format))
+    {
+      if (has_alpha)
+        {
+          *lcms_format = TYPE_RGBA_8;
+
+          return babl_format ("R'G'B'A u8");
+        }
+      else
+        {
+          *lcms_format = TYPE_RGB_8;
+
+          return babl_format ("R'G'B' u8");
+        }
+    }
   else
     {
       g_printerr ("format: %s\n"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]