[gimp] app: add gimp_babl_mask_format(precision)



commit c9e788c39d82406d85518477e64ac2b809d91f17
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 27 23:50:20 2012 +0200

    app: add gimp_babl_mask_format(precision)

 app/core/gimpimage.c |   11 +----------
 app/gegl/gimp-babl.c |   15 +++++++++++++++
 app/gegl/gimp-babl.h |    1 +
 3 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 73cf815..bddb338 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1532,16 +1532,7 @@ gimp_image_get_mask_format (const GimpImage *image)
 {
   g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
 
-  switch (gimp_image_get_precision (image))
-    {
-    case GIMP_PRECISION_U8:    return babl_format ("Y u8");
-    case GIMP_PRECISION_U16:   return babl_format ("Y u16");
-    case GIMP_PRECISION_U32:   return babl_format ("Y u32");
-    case GIMP_PRECISION_HALF:  return babl_format ("Y half");
-    case GIMP_PRECISION_FLOAT: return babl_format ("Y float");
-    }
-
-  g_return_val_if_reached (NULL);
+  return gimp_babl_mask_format (gimp_image_get_precision (image));
 }
 
 gint
diff --git a/app/gegl/gimp-babl.c b/app/gegl/gimp-babl.c
index 105306c..c603c01 100644
--- a/app/gegl/gimp-babl.c
+++ b/app/gegl/gimp-babl.c
@@ -389,6 +389,21 @@ gimp_babl_format (GimpImageBaseType  base_type,
 }
 
 const Babl *
+gimp_babl_mask_format (GimpPrecision precision)
+{
+  switch (precision)
+    {
+    case GIMP_PRECISION_U8:    return babl_format ("Y u8");
+    case GIMP_PRECISION_U16:   return babl_format ("Y u16");
+    case GIMP_PRECISION_U32:   return babl_format ("Y u32");
+    case GIMP_PRECISION_HALF:  return babl_format ("Y half");
+    case GIMP_PRECISION_FLOAT: return babl_format ("Y float");
+    }
+
+  g_return_val_if_reached (NULL);
+}
+
+const Babl *
 gimp_babl_component_format (GimpImageBaseType base_type,
                             GimpPrecision     precision,
                             gint              index)
diff --git a/app/gegl/gimp-babl.h b/app/gegl/gimp-babl.h
index efadeae..4f08c35 100644
--- a/app/gegl/gimp-babl.h
+++ b/app/gegl/gimp-babl.h
@@ -32,6 +32,7 @@ GimpPrecision       gimp_babl_format_get_precision  (const Babl        *format);
 const Babl        * gimp_babl_format                (GimpImageBaseType  base_type,
                                                      GimpPrecision      precision,
                                                      gboolean           with_alpha);
+const Babl        * gimp_babl_mask_format           (GimpPrecision      precision);
 const Babl        * gimp_babl_component_format      (GimpImageBaseType  base_type,
                                                      GimpPrecision      precision,
                                                      gint               index);



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