acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

png_support.ino (912B)

      1 
      2 // PNGdec support functions
      3 
      4 //=========================================v==========================================
      5 //  pngDraw: Callback function to draw pixels to the display
      6 //====================================================================================
      7 // This function will be called during decoding of the png file to render each image
      8 // line to the TFT. PNGdec generates the image line and a 1bpp mask.
      9 void pngDraw(PNGDRAW *pDraw) {
     10   uint16_t lineBuffer[MAX_IMAGE_WIDTH];          // Line buffer for rendering
     11   uint8_t  maskBuffer[1 + MAX_IMAGE_WIDTH / 8];  // Mask buffer
     12 
     13   png.getLineAsRGB565(pDraw, lineBuffer, PNG_RGB565_BIG_ENDIAN, 0xffffffff);
     14 
     15   if (png.getAlphaMask(pDraw, maskBuffer, 255)) {
     16     // Note: pushMaskedImage is for pushing to the TFT and will not work pushing into a sprite
     17     tft.pushMaskedImage(xpos, ypos + pDraw->y, pDraw->iWidth, 1, lineBuffer, maskBuffer);
     18   }
     19 }