[gimp] app: move gimp_babl_format_get_base_type() to gimp-babl.[ch]



commit ff931e1ded33d2a1aac4694194301a7074ba17f0
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 21 23:55:40 2012 +0200

    app: move gimp_babl_format_get_base_type() to gimp-babl.[ch]
    
    The GimpImageBaseType enum is going to go away, but a format -> enum
    API is going to stay around.

 app/core/gimpdrawable.c    |    1 +
 app/core/gimpimage-new.c   |    2 +-
 app/gegl/gimp-babl.c       |   24 ++++++++++++++++++++++++
 app/gegl/gimp-babl.h       |    6 ++++--
 app/gegl/gimp-gegl-utils.c |   24 ------------------------
 app/gegl/gimp-gegl-utils.h |    3 +--
 6 files changed, 31 insertions(+), 29 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 4573977..b9913be 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -28,6 +28,7 @@
 
 #include "base/pixel-region.h"
 
+#include "gegl/gimp-babl.h"
 #include "gegl/gimp-gegl-nodes.h"
 #include "gegl/gimp-gegl-utils.h"
 
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 58feddc..ac7c503 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -26,7 +26,7 @@
 
 #include "config/gimpcoreconfig.h"
 
-#include "gegl/gimp-gegl-utils.h"
+#include "gegl/gimp-babl.h"
 
 #include "gimp.h"
 #include "gimpbuffer.h"
diff --git a/app/gegl/gimp-babl.c b/app/gegl/gimp-babl.c
index 0d62bd3..63d47fa 100644
--- a/app/gegl/gimp-babl.c
+++ b/app/gegl/gimp-babl.c
@@ -122,3 +122,27 @@ gimp_babl_get_description (const Babl *babl)
   return g_strconcat ("ERROR: unknown Babl format ",
                       babl_get_name (babl), NULL);
 }
+
+GimpImageBaseType
+gimp_babl_format_get_base_type (const Babl *format)
+{
+  g_return_val_if_fail (format != NULL, -1);
+
+  if (format == babl_format ("Y u8")  ||
+      format == babl_format ("Y' u8") ||
+      format == babl_format ("Y'A u8"))
+    {
+      return GIMP_GRAY;
+    }
+  else if (format == babl_format ("R'G'B' u8") ||
+           format == babl_format ("R'G'B'A u8"))
+    {
+      return GIMP_RGB;
+    }
+  else if (babl_format_is_palette (format))
+    {
+      return GIMP_INDEXED;
+    }
+
+  g_return_val_if_reached (-1);
+}
diff --git a/app/gegl/gimp-babl.h b/app/gegl/gimp-babl.h
index 06dd3ec..9d56592 100644
--- a/app/gegl/gimp-babl.h
+++ b/app/gegl/gimp-babl.h
@@ -22,9 +22,11 @@
 #define __GIMP_BABL_H__
 
 
-void          gimp_babl_init            (void);
+void                gimp_babl_init                  (void);
 
-const gchar * gimp_babl_get_description (const Babl *babl);
+const gchar       * gimp_babl_get_description       (const Babl *babl);
+
+GimpImageBaseType   gimp_babl_format_get_base_type  (const Babl *format);
 
 
 #endif /* __GIMP_BABL_H__ */
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index f0501f4..6b56086 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -57,30 +57,6 @@ gimp_babl_format_get_image_type (const Babl *format)
   g_return_val_if_reached (-1);
 }
 
-GimpImageBaseType
-gimp_babl_format_get_base_type (const Babl *format)
-{
-  g_return_val_if_fail (format != NULL, -1);
-
-  if (format == babl_format ("Y u8")  ||
-      format == babl_format ("Y' u8") ||
-      format == babl_format ("Y'A u8"))
-    {
-      return GIMP_GRAY;
-    }
-  else if (format == babl_format ("R'G'B' u8") ||
-           format == babl_format ("R'G'B'A u8"))
-    {
-      return GIMP_RGB;
-    }
-  else if (babl_format_is_palette (format))
-    {
-      return GIMP_INDEXED;
-    }
-
-  g_return_val_if_reached (-1);
-}
-
 /**
  * gimp_bpp_to_babl_format:
  * @bpp: bytes per pixel
diff --git a/app/gegl/gimp-gegl-utils.h b/app/gegl/gimp-gegl-utils.h
index c7e54b5..072a313 100644
--- a/app/gegl/gimp-gegl-utils.h
+++ b/app/gegl/gimp-gegl-utils.h
@@ -25,8 +25,7 @@
 #include <gdk-pixbuf/gdk-pixbuf.h> /* temp hack */
 
 
-GimpImageType     gimp_babl_format_get_image_type (const Babl           *format);
-GimpImageBaseType gimp_babl_format_get_base_type  (const Babl           *format);
+GimpImageType    gimp_babl_format_get_image_type (const Babl            *format);
 
 const Babl  * gimp_bpp_to_babl_format            (guint                  bpp) G_GNUC_CONST;
 const Babl  * gimp_bpp_to_babl_format_with_alpha (guint                  bpp) G_GNUC_CONST;



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