Re: resource sizes with gdk-pixbuf-csource



On Mon, 7 Aug 2006, Matt Hoosier wrote:
On 8/7/06, tomas tuxteam de <tomas tuxteam de> wrote:
Seems you'll have to do the png decoding yourself :-(
Yes, I suspected this from the outset too. Thanks for the comments.

You can try to store the png file in an array of chars, then feed the data in that array to a GdkPixbufLoader. Something like this:

GdkPixbuf *
get_my_pixbuf (void)
{
  static const gchar data[] =
    { 0x89, 0x50, 0x4e, 0x47, /* ... the rest of the png file ... */ };
  GdkPixbufLoader *loader;
  GdkPixbuf *pixbuf;

  loader = gdk_pixbuf_loader_new ();
  gdk_pixbuf_loader_write (loader, data, sizeof data, NULL);
  pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
  g_object_unref (G_OBJECT (loader));
  return pixbuf;
}

HTH
JV



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