Re: gdk pixbuf animation

You'll have to manually add each frame from the animation at this point.
The next major gnome-libs release will support adding frames from a
GdkPixbufAnimation, but gnome-libs 1.0.x does not.

Try something to this effect:

   GdkPixbufAnimation *a_pixbuf;
   GtkWidget *animator;

   a_pixbuf = gdk_pixbuf_animation_new_from_file(filename);
      GList *list;
      GdkPixmap *pixmap;
      GdkBitmap *mask;
      GdkImlibImage *im;

      for(list = a_pixbuf->frames; list; list = list->next)
         /* This sort of sucks, but I can't think of a better way to
          * convert from a pixbuf into something GnomeAnimator 1.0 will
          * recognize.
         gdk_pixbuf_render_pixmap_and_mask(((GdkPixbufFrame *)list->data)->pixbuf,
                                           &pixmap, &mask, 0);
         im = gdk_imlib_create_image_from_drawable(pixmap, mask,
                                                   0, 0,
                                                   w, h);
         gnome_animator_append_frame_from_imlib(animator, im, 0, 0,
                                                ((GdkPixbufFrame *)list->data)->delay_time;

This isn't working code or anything, but you get the idea.  I've added
GdkPixbuf frame loading for gnome-libs 2.0, and it'll also have
GdkPixbufAnimation file loading as well.  But in the mean time, this hack
shouldn't be too bad.

Happy hacking,

On Tue, 29 Feb 2000, Ben K wrote:

> can i put a gdk-pixbuf animation into a GnomeCanvas?
> i have the normal GnomeCanvasPixbuf stuff working, but when i tried to 
> change it into an animated pixbuf, it segfaulted on me.  Has anyone done 
> this before?
> thanks for you help
> -bennyk
> ______________________________________________________
> Get Your Private, Free Email at
> -- 
> To unsubscribe: mail with "unsubscribe"
> as the Subject.

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