2 #ifdef USE_ONLINE_IMAGE_PNG_SUPPORT 8 static const char *
const TAG =
"online_image.png";
11 namespace online_image {
21 static void init_callback(pngle_t *pngle, uint32_t w, uint32_t
h) {
22 PngDecoder *decoder = (PngDecoder *) pngle_get_user_data(pngle);
23 decoder->set_size(w, h);
37 static void draw_callback(pngle_t *pngle, uint32_t
x, uint32_t
y, uint32_t w, uint32_t h, uint8_t rgba[4]) {
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);
46 ESP_LOGE(TAG,
"PNG decoder engine not initialized!");
49 pngle_set_user_data(this->
pngle_,
this);
50 pngle_set_init_callback(this->
pngle_, init_callback);
51 pngle_set_draw_callback(this->
pngle_, draw_callback);
57 ESP_LOGE(TAG,
"PNG decoder engine not initialized!");
61 ESP_LOGD(TAG,
"Waiting for data");
64 auto fed = pngle_feed(this->
pngle_, buffer, size);
66 ESP_LOGE(TAG,
"Error decoding image: %s", pngle_error(this->
pngle_));
76 #endif // USE_ONLINE_IMAGE_PNG_SUPPORT int prepare(size_t download_size) override
virtual int prepare(size_t download_size)
Initialize the decoder.
int HOT decode(uint8_t *buffer, size_t size) override
Implementation of SPI Controller mode.