how to show animation with gtk/gdk?
- From: Samu <samu linuxasylum net>
- To: gtk-app-devel-list gnome org
- Subject: how to show animation with gtk/gdk?
- Date: Tue, 23 Oct 2001 18:42:22 +0200
i'm trying to make a program that shows "animated pictures" using gtk/gdk.
the pictures are in xpm format ( they were on to another format but i can easily
convert them "on the fly" ).
i looked to the gtk tutorial and i found some example on how to use
gdk_pixmap_create_from_xpm_d() and attach them to a POPUP window .
it all works if i pick a frame , attach it to the windows through a "fixed"
and then exec gtk_main().
Problem: if i use gtk_main i can't pick-up a newer frame through
gdk_pixmap_create_from_xpm_d() because the window is displaying
and i get "Xlib async ..." error.
if i comment gtk_main() i can pick up next frame of my animation
but i can't display it 'cause i can't add the fixed widget to the window
as it was a container ( gtk_container_add( GTK_CONTAINER(mainWindow), fixed )) .
here's what it looks on to the code :
data = make_xpm_frame(fptr, charsPerPixel, count_color, f, frame, base_pos,
color_map, &img_color, &img_pixmap);
pixmap = gdk_pixmap_create_from_xpm_d(mainWindow->window,&mask,
gtpix = gtk_pixmap_new (pixmap,mask);
fixed = gtk_fixed_new();
gtk_widget_set_usize( fixed, xmax, ymax);
gtk_fixed_put( GTK_FIXED(fixed), gtpix, 0, 0 );
gtk_container_add( GTK_CONTAINER(mainWindow), fixed );
gtk_widget_shape_combine_mask( mainWindow, mask, 0, 0 );
where i'm in wrong ?
how could i use gtk_main() and make the "refresh" of the window
through callback ? (i don't want to push any button , just show
a frame every X seconds ) .
ps reply to me in CC too 'cause i'm not on the mailing-list
Samuele Tonon <samu linuxasylum net>
Undergraduate Student of Computer Science at University of Bologna, Italy
System administrator at Computer Science Lab's, University of Bologna, Italy
Founder & Member of A.A.H.T.
Acid -- better living through chemistry.
] [Thread Prev