5namespace 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);
94 uint8_t *
data(
size_t offset = 0);
110 size_t resize(
size_t size);
An STL allocator that uses SPI or internal RAM.
void deallocate(T *p, size_t n)
DownloadBuffer(size_t size)
size_t unread_
Total number of downloaded bytes not yet read.
size_t free_capacity() const
uint8_t * data(size_t offset=0)
RAMAllocator< uint8_t > allocator_
size_t resize(size_t size)
virtual ~DownloadBuffer()
Class to abstract decoding different image formats.
void draw(int x, int y, int w, int h, const Color &color)
Fill a rectangle on the display_buffer using the defined color.
virtual int prepare(size_t download_size)
Initialize the decoder.
ImageDecoder(OnlineImage *image)
Construct a new Image Decoder object.
virtual int decode(uint8_t *buffer, size_t size)=0
Decode a part of the image.
bool set_size(int width, int height)
Request the image to be resized once the actual dimensions are known.
virtual ~ImageDecoder()=default
Download an image from a given URL, and decode it using the specified decoder.
@ DECODE_ERROR_OUT_OF_MEMORY
@ DECODE_ERROR_UNSUPPORTED_FORMAT
@ DECODE_ERROR_INVALID_TYPE
Providing packet encoding functions for exchanging data with a remote host.