[gimp] libgimpcolor: add gimp_pixbuf_get_icc_profile()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpcolor: add gimp_pixbuf_get_icc_profile()
- Date: Tue, 16 Jun 2015 21:45:20 +0000 (UTC)
commit 4422128ecc427211e57217d67e6d2eadad8b490b
Author: Michael Natterer <mitch gimp org>
Date: Tue Jun 16 23:43:40 2015 +0200
libgimpcolor: add gimp_pixbuf_get_icc_profile()
which decodes and returns the pixbuf's base64-encoded "icc-profile"
property.
libgimpcolor/gimpcolor.def | 1 +
libgimpcolor/gimppixbuf.c | 37 +++++++++++++++++++++++++++++++++++++
libgimpcolor/gimppixbuf.h | 7 +++++--
3 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def
index 6220587..79e64dd 100644
--- a/libgimpcolor/gimpcolor.def
+++ b/libgimpcolor/gimpcolor.def
@@ -59,6 +59,7 @@ EXPORTS
gimp_param_spec_rgb_has_alpha
gimp_pixbuf_create_buffer
gimp_pixbuf_get_format
+ gimp_pixbuf_get_icc_profile
gimp_rgb_add
gimp_rgb_clamp
gimp_rgb_composite
diff --git a/libgimpcolor/gimppixbuf.c b/libgimpcolor/gimppixbuf.c
index bb44382..ac1f9ac 100644
--- a/libgimpcolor/gimppixbuf.c
+++ b/libgimpcolor/gimppixbuf.c
@@ -114,3 +114,40 @@ gimp_pixbuf_create_buffer (GdkPixbuf *pixbuf)
return buffer;
}
}
+
+/**
+ * gimp_pixbuf_get_icc_profile:
+ * @pixbuf: a #GdkPixbuf
+ * @length: return location for the ICC profile's length
+ *
+ * Returns the ICC profile attached to the @pixbuf, or %NULL if there
+ * is none.
+ *
+ * Return value: The ICC profile data, or %NULL. The value should be freed
+ * with g_free().
+ *
+ * Since: 2.10
+ **/
+guint8 *
+gimp_pixbuf_get_icc_profile (GdkPixbuf *pixbuf,
+ gsize *length)
+{
+ gchar *icc_base64 = NULL;
+
+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
+ g_return_val_if_fail (length != NULL, NULL);
+
+ g_object_get (pixbuf, "icc-profile", icc_base64, NULL);
+
+ if (icc_base64)
+ {
+ guint8 *icc_data;
+
+ icc_data = g_base64_decode (icc_base64, length);
+ g_free (icc_base64);
+
+ return icc_data;
+ }
+
+ return NULL;
+}
diff --git a/libgimpcolor/gimppixbuf.h b/libgimpcolor/gimppixbuf.h
index bad438e..58597e0 100644
--- a/libgimpcolor/gimppixbuf.h
+++ b/libgimpcolor/gimppixbuf.h
@@ -31,8 +31,11 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-const Babl * gimp_pixbuf_get_format (GdkPixbuf *pixbuf);
-GeglBuffer * gimp_pixbuf_create_buffer (GdkPixbuf *pixbuf);
+const Babl * gimp_pixbuf_get_format (GdkPixbuf *pixbuf);
+GeglBuffer * gimp_pixbuf_create_buffer (GdkPixbuf *pixbuf);
+
+guint8 * gimp_pixbuf_get_icc_profile (GdkPixbuf *pixbuf,
+ gsize *length);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]