[SDL] Animated GIFs

Doug biteme at bitbasher.net
Thu Apr 5 12:46:41 PDT 2007


In article <200704042006.37454.descent1 at gmx.net>, descent1 at gmx.net says...
>I was creating an animated GIF-file and included it into my program. But now 
>the GIF isn't animated. 
>I have the pictures seperate!
>Who can help me?

I worked on this and I made a small animated gif library, very similar to 
SDL's image library.

The project is not yet complete (lacks documentation and multiple OS support 
- only supports Win32 now), but all the source code is there for your 
animated gif enjoyment.

You can download it at: http://bitbasher.net/SDL/SDL_anigif.zip

I support compile options for VC6 and VS2005 under Win32.  The code is pretty 
simple and *should* compile easy on other platforms/OS.  The sample 
application is Win32-only as it actually uses Win32 calls.

During development, I noticed that "not all animated gif files are created 
equal".  That is, there are many strange and exotic ways to make an animated 
gif.  I downloaded hundreds of them, and so far, all of them will work with 
this code - so far :P.  It's important to determine (in your app) if you want 
the animated gif to be overlayed (on top of existing image data) or full 
frame (the size of the animated gif IS the surface size).  You can optimize 
the display of the animated somewhat based on how you use them.

Doug.




More information about the SDL mailing list