mrcodetastic / ESP32-HUB75-MatrixPanel-DMA

An Adafruit GFX Compatible Library for the ESP32, ESP32-S2, ESP32-S3 to drive HUB75 LED matrix panels using DMA for high refresh rates. Supports panel chaining.
MIT License
970 stars 211 forks source link

Transparent GIFs with different layer sizes #685

Open OzerOzdemir opened 1 month ago

OzerOzdemir commented 1 month ago

When a transparent gif has layers with different sizes, the animation looks off with lots of artifacts. This is present in multiple example sources, and also seems to be the original root cause of https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA/issues/631

The fix is to set x to pDraw->iX, similar to how y is set to y = pDraw->iY + pDraw->y; // current line

    if (pDraw->ucHasTransparency) // if transparency used
    {
      uint8_t *pEnd, c, ucTransparent = pDraw->ucTransparent;
      int x, iCount;
      pEnd = s + pDraw->iWidth;
      x = 0 // ----------- > This should be x = pDraw->iX;
panki27 commented 5 days ago

The issue exists not in this library, but in https://github.com/bitbank2/AnimatedGIF (or rather the provided sample code). While your fix has improved things, it didn't completely solve all the ghosting issues I had.

I found a workaround:

This will turn the GIF into a slideshow of full frames, no transparency or layers involved. After doing this, I got a 3100 frame GIF to play flawlessly.