Bodmer / TJpg_Decoder

Jpeg decoder library based on Tiny JPEG Decompressor
Other
222 stars 42 forks source link

Possible to add JPG into sprite? #44

Closed scarolan closed 2 years ago

scarolan commented 2 years ago

I've gotten your example code from here working:

https://github.com/Bodmer/TJpg_Decoder/blob/master/examples/SPIFFS/SPIFFS_Jpg/SPIFFS_Jpg.ino#L28-L41

I'm curious whether it's possible to add JPGs onto sprite objects. Right now I have this full-screen sprite that I've been adding text and shapes onto. Can you do the same with a JPG?

scarolan commented 2 years ago

I RTFM and realized you can do this, works like a charm

TFT_eSprite img = TFT_eSprite(&tft);

bool img_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t* bitmap)
{
  if ( y >= img.height() ) return 0;
  img.pushImage(x, y, w, h, bitmap);
  return 1;
}