2 #ifdef USE_ONLINE_IMAGE_PNG_SUPPORT 9 static const char *
const TAG =
"online_image.png";
12 namespace online_image {
22 static void init_callback(pngle_t *pngle, uint32_t w, uint32_t
h) {
23 PngDecoder *decoder = (PngDecoder *) pngle_get_user_data(pngle);
24 decoder->set_size(w, h);
38 static void draw_callback(pngle_t *pngle, uint32_t
x, uint32_t
y, uint32_t w, uint32_t h, uint8_t rgba[4]) {
39 PngDecoder *decoder = (PngDecoder *) pngle_get_user_data(pngle);
40 Color color(rgba[0], rgba[1], rgba[2], rgba[3]);
41 decoder->draw(x, y, w, h, color);
46 pngle_set_user_data(this->
pngle_,
this);
47 pngle_set_init_callback(this->
pngle_, init_callback);
48 pngle_set_draw_callback(this->
pngle_, draw_callback);
53 ESP_LOGE(TAG,
"PNG decoder engine not initialized!");
57 ESP_LOGD(TAG,
"Waiting for data");
60 auto fed = pngle_feed(this->
pngle_, buffer, size);
62 ESP_LOGE(TAG,
"Error decoding image: %s", pngle_error(this->
pngle_));
72 #endif // USE_ONLINE_IMAGE_PNG_SUPPORT virtual void prepare(uint32_t download_size)
Initialize the decoder.
int HOT decode(uint8_t *buffer, size_t size) override
Implementation of SPI Controller mode.
void prepare(uint32_t download_size) override