6 namespace online_image {
41 virtual int decode(uint8_t *buffer,
size_t size);
50 void set_size(
int width,
int height);
64 void draw(
int x,
int y,
int w,
int h,
const Color &color);
81 this->buffer_ = this->allocator_.allocate(size);
85 virtual ~DownloadBuffer() { this->allocator_.deallocate(this->buffer_, this->size_); }
87 uint8_t *data(
size_t offset = 0);
89 uint8_t *
append() {
return this->data(this->unread_); }
91 size_t unread()
const {
return this->unread_; }
92 size_t size()
const {
return this->size_; }
95 size_t read(
size_t len);
virtual ~DownloadBuffer()
DownloadBuffer(size_t size)
virtual void prepare(uint32_t download_size)
Initialize the decoder.
Download an image from a given URL, and decode it using the specified decoder.
Class to abstract decoding different image formats.
virtual ~ImageDecoder()=default
size_t free_capacity() const
ImageDecoder(OnlineImage *image)
Construct a new Image Decoder object.
virtual int decode(uint8_t *buffer, size_t size)
Decode a part of the image.
void draw(int x, int y, int w, int h, const Color &color)
Draw a rectangle on the display_buffer using the defined color.
ExternalRAMAllocator< uint8_t > allocator_
size_t unread_
Total number of downloaded bytes not yet read.
void set_size(int width, int height)
Request the image to be resized once the actual dimensions are known.
Implementation of SPI Controller mode.