Re: How to embed/inline jpg images in compressed form



Christof Petig <christof petig-baender de> writes:

> Learning to praise the features of gtk+-2.0 I quickly came to a question:
> 
> Is it possible to embed (or inline if you prefer) jpeg (or png) images
> in an gtk+ 2.0 application without uncompressing them (as done via
> gdk-pixbuf-csource).

I haven't tried but it should work using the pixbuf-loader API:

GdkPixbufLoader *    gdk_pixbuf_loader_new           (void);
GdkPixbufLoader *    gdk_pixbuf_loader_new_with_type (const char *image_type,
                                                      GError    **error);
gboolean             gdk_pixbuf_loader_write         (GdkPixbufLoader *loader,
                                                      const guchar    *buf,
                                                      gsize            count,
                                                      GError         **error);
GdkPixbuf *          gdk_pixbuf_loader_get_pixbuf    (GdkPixbufLoader *loader);
GdkPixbufAnimation * gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader);
gboolean             gdk_pixbuf_loader_close         (GdkPixbufLoader *loader,
                                                      GError         **error);

you create a new pixbuf loader, feed it the inline data, close it,
retrieve the pixbuf and unref the loader. Voila.


Salut, Sven




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