2#ifdef USE_RUNTIME_IMAGE_PNG
9static const char *
const TAG =
"image_decoder.png";
22 PngDecoder *decoder = (PngDecoder *) pngle_get_user_data(pngle);
23 decoder->set_size(w,
h);
38 PngDecoder *decoder = (PngDecoder *) pngle_get_user_data(pngle);
39 Color color(rgba[0], rgba[1], rgba[2], rgba[3]);
40 decoder->draw(
x,
y, w,
h, color);
45 decoder->increment_pixels_decoded(pixels);
46 if ((decoder->get_pixels_decoded() % 1024) < pixels) {
54 pngle_t *pngle = allocator.
allocate(1, PNGLE_T_SIZE);
56 ESP_LOGE(TAG,
"Failed to allocate memory for PNGLE engine!");
59 memset(pngle, 0, PNGLE_T_SIZE);
76 ESP_LOGE(TAG,
"PNG decoder engine not initialized!");
79 pngle_set_user_data(this->
pngle_,
this);
80 pngle_set_init_callback(this->
pngle_, init_callback);
81 pngle_set_draw_callback(this->
pngle_, draw_callback);
87 ESP_LOGE(TAG,
"PNG decoder engine not initialized!");
92 ESP_LOGD(TAG,
"Waiting for more data");
95 auto fed = pngle_feed(this->
pngle_, buffer,
size);
97 ESP_LOGE(TAG,
"Error decoding image: %s", pngle_error(this->
pngle_));
void feed_wdt(uint32_t time=0)
An STL allocator that uses SPI or internal RAM.
void deallocate(T *p, size_t n)
Class to abstract decoding different image formats.
virtual int prepare(size_t expected_size)
Initialize the decoder.
int HOT decode(uint8_t *buffer, size_t size) override
PngDecoder(RuntimeImage *image)
Construct a new PNG Decoder object.
int prepare(size_t expected_size) override
A dynamic image that can be loaded and decoded at runtime.
@ DECODE_ERROR_OUT_OF_MEMORY
Application App
Global storage of Application pointer - only one Application can exist.