mirror of https://github.com/GNOME/gimp.git
libgimpcolor: add gimp_pixbuf_get_icc_profile()
which decodes and returns the pixbuf's base64-encoded "icc-profile" property.
This commit is contained in:
parent
16971ff186
commit
4422128ecc
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ G_BEGIN_DECLS
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue