[maemo-developers] GtkPixbuf from Char buffer

From: Kemal Hadimli disqkk at gmail.com
Date: Thu Oct 16 18:10:55 EEST 2008
>From Maemopad+ (https://garage.maemo.org/plugins/scmsvn/viewcvs.php/trunk/unified/src/ui/callbacks.c?revision=94&root=maemopadplus&view=markup
)

GdkPixbufLoader *pl = gdk_pixbuf_loader_new_with_type("png", NULL);
GError *err = NULL;
gdk_pixbuf_loader_write(pl, (guchar *) blob, blobsize, &err);
f (err != NULL)
{
//error
g_error_free(err);
return;
}
gdk_pixbuf_loader_close(pl, NULL);
GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(pl);

if (GDK_IS_PIXBUF(pixbuf))
{
//do stuff
}
g_object_unref(pl);


On Thu, Oct 16, 2008 at 5:12 PM, Arto Karppinen
<arto.karppinen at mail.suomi.net> wrote:
>
> Hi, were developing an application which is supposed to show user images
> downloaded from web server using xmlrpc. The problem is that we cant
> quite figure out how to create a pixbuf from a buffer which contains the
> RAW contents of a file.
>
> Functions like:
>
>    gdk_pixbuf_new_from_data
>    gdk_pixbuf_new_from_inline
>    gdk_pixbuf_from_pixdata
>
> all seem to expect the image to be in some particular format already,
> while what we need is more like gdk_pixbuf_new_from_file() which is able
> to autodetect everything and just read the file.
>
> All information that our application has about the image are:
>  - Name of file.
>  - Size of file.
>  - Contents of file.
>
> --
> Arto Karppinen
> ------------------------------
> arto.karppinen at iki.fi
> _______________________________________________
> maemo-developers mailing list
> maemo-developers at maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers



--
Kemal

More information about the maemo-developers mailing list