Re: GdkPixbufAnimation get number of frames ?



On 02 Oct 2002 13:47:59 +0200, Matthias Clasen wrote:
> I believe that gdk_pixbuf_animation_iter_on_currently_loading_frame () 
> tells you wether you are on the last frame; at least the API doc says:
> 
> Returns : TRUE if the frame we're on is partially loaded, or the last 
> frame

This is working with the gif-io at least.
Thanks a lot.



> 
> Maybe you are right that GdkPixbufAnimation should allow to control 
> looping behaviour, and the gif loader should read the netscape
> application extension to control looping. I just found some specs for 
> this: http://members.aol.com/royalef/gifabout.htm#net-extension

for my purposes the interface is sufficient. When i dont want looping,
i check whether i am on the last frame.

BTW here is the loader code:

static GList *get_anim_list( char *name ) {

   GError *err;
   GTimeVal time;
   GdkPixbufAnimation *animation = gdk_pixbuf_animation_new_from_file(
name, &err );
   GdkPixbufAnimationIter *iter;
   GList *retval = NULL;

   g_get_current_time( &time );
   iter = gdk_pixbuf_animation_get_iter( animation, &time );

   while(1) {
       GdkPixbuf *pixbuf = gdk_pixbuf_animation_iter_get_pixbuf(iter);
       int delay = gdk_pixbuf_animation_iter_get_delay_time( iter );

       retval = g_list_append( retval, gdk_pixbuf_copy( pixbuf ) );

       if( gdk_pixbuf_animation_iter_on_currently_loading_frame( iter )
)
           return retval;

       g_time_val_add( &time, delay*1000 );
       gdk_pixbuf_animation_iter_advance( iter, &time );
   }

   // not reached....
   return retval;
}



> 
> Matthias
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 




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