Re: reload image from a file into a pixbuffer
- From: tomas tuxteam de
- To: Yianni <odysseus lost gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: reload image from a file into a pixbuffer
- Date: Wed, 1 Nov 2006 15:27:21 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, Nov 01, 2006 at 09:56:03AM +0000, Yianni wrote:
Hi,
a very simple question.... but I cannot find an answer in the api.... How do
I load a picture from a file into a pixbuffer? I tried with g_timeout_add
and using the following code (which obviously not only does not work but has
memory leak problems)....
gboolean
draw_image()
{
GdkPixbuf *arena;
GString *str = g_string_new("");
if (Counter % 2)
g_string_assign(str, "img1.jpg");
else
g_string_assign(str, "img2.jpg");
arena = gdk_pixbuf_new_from_file(str->str, NULL);
gtk_widget_set_size_request(lookup_widget(RootWindow,
"drawingareaDisplay"), gdk_pixbuf_get_width(arena),
gdk_pixbuf_get_height(arena));
Counter++;
g_string_free(str, TRUE);
return TRUE;
}
What are you esactly trying to achieve? Something like a blinking image?
Where will the pixbuf be shown?
One mem leak might be the gdk_pixbuf_new_from_file(): you keep creating
a new pixbuf on each entry to the function and never seem to destroy
it...
Regards
- -- tomÃs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFSLzZBcgs9XrR2kYRAtbVAJ9ESM/+DnYiXvwVxqLvPkvmz/S44wCcDWg1
g02cQXgepdI9r95LyxyMLiQ=
=E8iQ
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]