[gimp] libgimpwidgets: support cairo formats in gimp_color_profile_get_format()



commit 608f254b33d0a6dfa844f1f6746afc7cadd130d0
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 2 20:31:31 2015 +0200

    libgimpwidgets: support cairo formats in gimp_color_profile_get_format()
    
    so color profile transforms can write directly to cairo-RGB24 and
    cairo-ARGB32 surfaces.

 libgimpcolor/gimpcolorprofile.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c
index df2081b..55f29ba 100644
--- a/libgimpcolor/gimpcolorprofile.c
+++ b/libgimpcolor/gimpcolorprofile.c
@@ -965,8 +965,28 @@ gimp_color_profile_get_format (const Babl *format,
     {
       linear = FALSE;
     }
+  else if (format == babl_format ("cairo-RGB24"))
+    {
+      *lcms_format = TYPE_RGB_8;
+
+      return babl_format ("R'G'B' u8");
+    }
+  else if (format == babl_format ("cairo-ARGB32"))
+    {
+      *lcms_format = TYPE_RGBA_8;
+
+      return babl_format ("R'G'B'A u8");
+    }
   else
     {
+      g_printerr ("format: %s\n"
+                  "has_alpha = %s\n"
+                  "type = %s\n"
+                  "model = %s\n",
+                  babl_get_name (format),
+                  has_alpha ? "TRUE" : "FALSE",
+                  babl_get_name (type),
+                  babl_get_name (model));
       g_return_val_if_reached (NULL);
     }
 


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