Skip to content

Conversation

@jetrotal
Copy link
Contributor

EasyRPG is now able to render gif animations.
Based on libnsgif used in mkxp-z: https://github.com/netsurf-plan9/libnsgif (MIT license).

gif for quick testing:
heroes

This PR Introduces GIF image decoding and animation support by adding new source files for GIF and LZW decoding, animated bitmap management, and GIF image handling. Updates build scripts to include new sources, extends Bitmap creation to detect and load GIFs as AnimatedBitmap, and registers '.gif' as a supported image type. Also ensures proper virtual destructor in Bitmap and integrates animated bitmap update logic.

I tried to inject the code very early on the image pipeline, to affect every image source.


Known hiccups from current approach: Picture effects, such as flip or overlay color mode locks the gif into a single frame, I'm not that aware about the entire pipeline to solve that...

EasyRPG is now able to render gif animations.
Based on libnsgif used in mkxp-z:  https://github.com/netsurf-plan9/libnsgif (MIT license).

This PR Introduces GIF image decoding and animation support by adding new source files for GIF and LZW decoding, animated bitmap management, and GIF image handling. Updates build scripts to include new sources, extends Bitmap creation to detect and load GIFs as AnimatedBitmap, and registers '.gif' as a supported image type. Also ensures proper virtual destructor in Bitmap and integrates animated bitmap update logic.

I tried to inject the code very early on the image pipeline, to affect every image source.

Known hiccups from current approach: Picture effects, such as flip or overlay color mode locks the gif into a single frame, I'm not that aware about the entire pipeline to solve that...
Added GNU GPL license headers to animated_bitmap and image_gif source/header files. Updated lzw.h and nsgif.h to add extern "C" guards for C++ compatibility and improved formatting and documentation. Minor cleanup in bitmap.cpp.

Update README.md
@Ghabry
Copy link
Member

Ghabry commented Oct 29, 2025

When I attempted implementing APNG (animated PNG) or AseSprite animation stuff I was stuck at exactly the same problem: The bitmap is duplicated via a blit and this causes the animation to be lost. :)

The bitmap API is unfortunately far too complicated (sooooo many methods) and overwriting all of them is alot of work (and error prone as most overloads would be the same and just lame forwarders).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants