Commit f2206a38 authored by Bastien Nocera's avatar Bastien Nocera Committed by Matthias Clasen
Browse files

gdk-pixbuf: Add gdk_pixbuf_copy_options() helper

https://bugzilla.gnome.org/show_bug.cgi?id=768043
parent ecdb61b6
......@@ -539,6 +539,9 @@ const gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
const gchar *key);
GDK_PIXBUF_AVAILABLE_IN_2_32
GHashTable * gdk_pixbuf_get_options (GdkPixbuf *pixbuf);
GDK_PIXBUF_AVAILABLE_IN_2_36
gboolean gdk_pixbuf_copy_options (GdkPixbuf *src_pixbuf,
GdkPixbuf *dest_pixbuf);
G_END_DECLS
......
......@@ -1022,6 +1022,46 @@ gdk_pixbuf_set_option (GdkPixbuf *pixbuf,
return TRUE;
}
/**
* gdk_pixbuf_copy_options:
* @src_pixbuf: a #GdkPixbuf to copy options from
* @dest_pixbuf: the #GdkPixbuf to copy options to
*
* Copy the key/value pair options attached to a #GdkPixbuf to another.
* This is useful to keep original metadata after having manipulated
* a file. However be careful to remove metadata which you've already
* applied, such as the "orientation" option after rotating the image.
*
* Return value: %TRUE on success.
*
* Since: 2.36
**/
gboolean
gdk_pixbuf_copy_options (GdkPixbuf *src_pixbuf,
GdkPixbuf *dest_pixbuf)
{
GQuark quark;
gchar **options;
g_return_val_if_fail (GDK_IS_PIXBUF (src_pixbuf), FALSE);
g_return_val_if_fail (GDK_IS_PIXBUF (dest_pixbuf), FALSE);
quark = g_quark_from_static_string ("gdk_pixbuf_options");
options = g_object_dup_qdata (G_OBJECT (src_pixbuf),
quark,
(GDuplicateFunc) g_strdupv,
NULL);
if (options == NULL)
return TRUE;
g_object_set_qdata_full (G_OBJECT (dest_pixbuf), quark,
options, (GDestroyNotify) g_strfreev);
return TRUE;
}
static void
gdk_pixbuf_set_property (GObject *object,
guint prop_id,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment