ESPHome  2024.11.0
png_image.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "image_decoder.h"
4 #ifdef USE_ONLINE_IMAGE_PNG_SUPPORT
5 #include <pngle.h>
6 
7 namespace esphome {
8 namespace online_image {
9 
13 class PngDecoder : public ImageDecoder {
14  public:
20  PngDecoder(OnlineImage *image) : ImageDecoder(image), pngle_(pngle_new()) {}
21  ~PngDecoder() override { pngle_destroy(this->pngle_); }
22 
23  void prepare(uint32_t download_size) override;
24  int HOT decode(uint8_t *buffer, size_t size) override;
25 
26  protected:
27  pngle_t *pngle_;
28 };
29 
30 } // namespace online_image
31 } // namespace esphome
32 
33 #endif // USE_ONLINE_IMAGE_PNG_SUPPORT
PngDecoder(OnlineImage *image)
Construct a new PNG Decoder object.
Definition: png_image.h:20
Download an image from a given URL, and decode it using the specified decoder.
Definition: online_image.h:37
Class to abstract decoding different image formats.
Definition: image_decoder.h:13
int HOT decode(uint8_t *buffer, size_t size) override
Definition: png_image.cpp:51
Image decoder specialization for PNG images.
Definition: png_image.h:13
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void prepare(uint32_t download_size) override
Definition: png_image.cpp:44