Re: additional gdk_pixbuf function: gdk_pixbuf_list_options
- From: Cody Russell <bratsche gnome org>
- To: gtk-devel-list <gtk-devel-list gnome org>
- Cc: "olivergranert gmx de" <olivergranert gmx de>
- Subject: Re: additional gdk_pixbuf function: gdk_pixbuf_list_options
- Date: Fri, 7 Oct 2011 17:48:35 -0500
Hi Oliver,
It's always great to get patches from new developers. Typically you should either create a new bug on
bugzilla.gnome.org or you should email one of the mailing lists. I'm adding
gtk-devel-list gnome org to this email so someone there can try to help you with your patch.
If you don't have an account on Bugzilla yet, I'd recommend creating one and posting your patch as a feature request to the GTK+ module.
Thanks,
Cody
On Fri, Oct 7, 2011 at 5:16 PM,
olivergranert gmx de <olivergranert gmx de> wrote:
Dear Cody Russell,
I have written a small additional function for the gdk_pixbuf library (see below).
The library provides two functions gdk_pixbuf_set_option and gdk_pixbuf_get_option to set/get key value pairs, but if you don't know the names of the keys available you can not access the values. This new function returns a list of all key attached to the gdk_pixbuf.
The function should be added into the gdk-pixbuf/gdk-pixbuf.c file (approximately at line 715).
Hope with your help the function could enter the gdk_pixbuf source tree.
Thank you very much
Oliver Granert
---------------------
/**
* gdk_pixbuf_list_options:
* @pixbuf: a #GdkPixbuf
*
* Returns a list with all keys in the list of options that may have been attached
* to the @pixbuf when it was loaded, or that may have been attached by another
* function using gdk_pixbuf_set_option().
* Use gdk_pixbuf_get_option() to get the values for each key in the returned list.
*
* For instance, the ANI loader provides "Title" and "Artist" options.
* The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
* options for cursor definitions. The PNG loader provides the tEXt ancillary
* chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
* return an "orientation" option string that corresponds to the embedded
* TIFF/Exif orientation tag (if present).
*
* Return value: A newly-allocated NULL-terminated array of key strings.
* Use g_strfreev() to free it.
*
* Since: 2.25
**/
gchar **
gdk_pixbuf_list_options (GdkPixbuf *pixbuf)
{
gchar **options;
gchar **keys=NULL;
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
options = g_object_get_qdata (G_OBJECT (pixbuf),
g_quark_from_static_string ("gdk_pixbuf_options"));
if (options) {
gint length,i;
for (length = 0; options[2*length]; length++); /* determine list length */
keys = g_new (gchar*, length + 1);
keys[length-1] = NULL; /* mark last entry */
if(keys!=NULL) {
for (i = 0; i<length; i++){
keys[i]=g_strdup(options[2*i]);
}
}
}
return keys;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]