5 namespace online_image {
34 virtual int prepare(
size_t download_size) {
50 virtual int decode(uint8_t *buffer,
size_t size) = 0;
60 bool set_size(
int width,
int height);
74 void draw(
int x,
int y,
int w,
int h,
const Color &color);
92 virtual ~DownloadBuffer() { this->allocator_.deallocate(this->buffer_, this->size_); }
94 uint8_t *data(
size_t offset = 0);
96 uint8_t *
append() {
return this->data(this->unread_); }
98 size_t unread()
const {
return this->unread_; }
99 size_t size()
const {
return this->size_; }
102 size_t read(
size_t len);
104 this->unread_ +=
len;
105 return this->unread_;
110 size_t resize(
size_t size);
virtual ~DownloadBuffer()
virtual int prepare(size_t download_size)
Initialize the decoder.
virtual int decode(uint8_t *buffer, size_t size)=0
Decode a part of the image.
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.
void draw(int x, int y, int w, int h, const Color &color)
Fill a rectangle on the display_buffer using the defined color.
bool set_size(int width, int height)
Request the image to be resized once the actual dimensions are known.
size_t unread_
Total number of downloaded bytes not yet read.
Implementation of SPI Controller mode.