[plt-scheme] Gif in canvas

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Apr 23 08:07:02 EDT 2009

At Thu, 23 Apr 2009 08:21:40 +0100, Stephen De Gabrielle wrote:
> I don't believe Canvas will play an animated gif for you.

Right. 

When `bitmap%' reads a GIF file, it ignores all but the first image in
an animation. More generally, the `bitmap%' class represents a single
image, so the multiple images that can be in a GIF file would require
multiple `bitmap%'s.

[A library that reads a GIF and returns multiple `bitmap%'s would be
 very welcome! We have a library to write animated GIFs, but we don't
 yet have a Scheme-implemented library to read GIFs.]

> DrScheme does use animations though - I'd try a source search of
> collects/ to see how the 'running man' effect is achieved.
> (start by looking for the image, then using its filename find the code)

It uses a thread or a timer to trigger an update of the canvas, each
time changing the bitmap that is drawn in the canvas.



Posted on the users mailing list.