[gimp/goat-invasion: 441/526] app: add gimp_babl_format_get_image_type, base_type()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 441/526] app: add gimp_babl_format_get_image_type, base_type()
- Date: Sun, 22 Apr 2012 13:36:19 +0000 (UTC)
commit 0e23ff36d9b3ac9c2924d40354efc0f86d3e1a91
Author: Michael Natterer <mitch gimp org>
Date: Sat Apr 7 02:24:07 2012 +0200
app: add gimp_babl_format_get_image_type,base_type()
app/gegl/gimp-gegl-utils.c | 47 ++++++++++++++++++++++++++++++++++++++++++++
app/gegl/gimp-gegl-utils.h | 3 ++
2 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index 0d8247f..7995476 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -33,6 +33,53 @@
#include "gimptilebackendtilemanager.h"
+GimpImageType
+gimp_babl_format_get_image_type (const Babl *format)
+{
+ g_return_val_if_fail (format != NULL, -1);
+
+ if (format == babl_format ("Y' u8"))
+ return GIMP_GRAY_IMAGE;
+ else if (format == babl_format ("Y'A u8"))
+ return GIMP_GRAYA_IMAGE;
+ else if (format == babl_format ("R'G'B' u8"))
+ return GIMP_RGB_IMAGE;
+ else if (format == babl_format ("R'G'B'A u8"))
+ return GIMP_RGBA_IMAGE;
+ else if (babl_format_is_palette (format))
+ {
+ if (babl_format_has_alpha (format))
+ return GIMP_INDEXEDA_IMAGE;
+ else
+ return GIMP_INDEXED_IMAGE;
+ }
+
+ 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'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 ca3a8a7..ec0ae23 100644
--- a/app/gegl/gimp-gegl-utils.h
+++ b/app/gegl/gimp-gegl-utils.h
@@ -25,6 +25,9 @@
#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);
+
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]