You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
698 B
C++
42 lines
698 B
C++
4 years ago
|
#include <Arduino.h>
|
||
|
#include "imagePNG.h"
|
||
|
#include "pngle.h"
|
||
|
#include "display.h"
|
||
|
|
||
4 years ago
|
pngle_t *pngle;
|
||
4 years ago
|
|
||
4 years ago
|
void on_draw(pngle_t *pngle, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint8_t rgba[4])
|
||
|
{
|
||
|
ImageProcessPixel(x, y, rgba);
|
||
|
}
|
||
4 years ago
|
|
||
|
void setupImagePNG()
|
||
|
{
|
||
4 years ago
|
Serial.println("setupPNG");
|
||
|
|
||
4 years ago
|
pngle = pngle_new();
|
||
|
pngle_set_draw_callback(pngle, on_draw);
|
||
4 years ago
|
}
|
||
|
|
||
|
void pngOpenFramebuffer()
|
||
|
{
|
||
|
displayOpen();
|
||
4 years ago
|
pngle_reset(pngle);
|
||
4 years ago
|
}
|
||
|
|
||
|
void pngWriteFramebuffer(int offset, uint8_t bitmap[], int c)
|
||
|
{
|
||
4 years ago
|
Serial.print(".");
|
||
|
|
||
4 years ago
|
int fed = pngle_feed(pngle, bitmap, c);
|
||
|
if (fed < 0)
|
||
4 years ago
|
{
|
||
4 years ago
|
Serial.println(pngle_error(pngle));
|
||
4 years ago
|
}
|
||
|
}
|
||
|
|
||
|
void pngFlushFramebuffer()
|
||
|
{
|
||
4 years ago
|
Serial.println("pngFlushFramebuffer");
|
||
|
pngle_reset(pngle);
|
||
4 years ago
|
}
|