attaching ancillary information to pixbufs



gdk-pixbuf has the gdk_pixbuf_[gs]et_option methods for storing key-value 
pairs of strings, which is currently only used (and was designed) to hold 
text chunks found in pngs.
Recently I found more situations where I would like to store integers as 
values, e.g. hot spot coordinates from CUR (and in future maybe xcursor) 
files, number of colors or bpp.
While it would be possible to do gdk_pixbuf_set_option (pixbuf, "x_hot", 
g_strdup_printf ("%d", x_hot)) and maybe even wrap that in a 
gdk_pixbuf_set_integer_option (GdkPixbuf *, int),
it looks very ugly. Would it be acceptable to extend the set_option 
mechanism to store string-GValue pairs ? The old API would of course be 
kept as a wrapper around the
new implementation. Along the lines of

void gdk_pixbuf_set_attribute (GdkPixbuf *pixbuf, gchar *key, GValue 
value);
G_CONST_RETURN GValue *gdk_pixbuf_get_attribute (GdkPixbuf *pixbuf, gchar 
*key) ;

Matthias



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]