Class to abstract decoding different image formats.
More...
#include <image_decoder.h>
Class to abstract decoding different image formats.
Definition at line 13 of file image_decoder.h.
◆ ImageDecoder()
esphome::online_image::ImageDecoder::ImageDecoder |
( |
OnlineImage * |
image | ) |
|
|
inline |
Construct a new Image Decoder object.
- Parameters
-
image | The image to decode the stream into. |
Definition at line 20 of file image_decoder.h.
◆ ~ImageDecoder()
virtual esphome::online_image::ImageDecoder::~ImageDecoder |
( |
| ) |
|
|
virtualdefault |
◆ decode()
virtual int esphome::online_image::ImageDecoder::decode |
( |
uint8_t * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
virtual |
Decode a part of the image.
It will try reading from the buffer. There is no guarantee that the whole available buffer will be read/decoded; the method will return the amount of bytes actually decoded, so that the unread content can be moved to the beginning.
- Parameters
-
buffer | The buffer to read from. |
size | The maximum amount of bytes that can be read from the buffer. |
- Returns
- int The amount of bytes read. It can be 0 if the buffer does not have enough content to meaningfully decode anything, or negative in case of a decoding error.
Reimplemented in esphome::online_image::PngDecoder.
◆ draw()
void esphome::online_image::ImageDecoder::draw |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
w, |
|
|
int |
h, |
|
|
const Color & |
color |
|
) |
| |
Draw a rectangle on the display_buffer using the defined color.
Will check the given coordinates for out-of-bounds, and clip the rectangle accordingly. In case of binary displays, the color will be converted to binary as well. Called by the callback functions, to be able to access the parent Image class.
- Parameters
-
x | The left-most coordinate of the rectangle. |
y | The top-most coordinate of the rectangle. |
w | The width of the rectangle. |
h | The height of the rectangle. |
color | The color to draw the rectangle with. |
Definition at line 17 of file image_decoder.cpp.
◆ is_finished()
bool esphome::online_image::ImageDecoder::is_finished |
( |
| ) |
const |
|
inline |
◆ prepare()
virtual void esphome::online_image::ImageDecoder::prepare |
( |
uint32_t |
download_size | ) |
|
|
inlinevirtual |
◆ set_size()
void esphome::online_image::ImageDecoder::set_size |
( |
int |
width, |
|
|
int |
height |
|
) |
| |
Request the image to be resized once the actual dimensions are known.
Called by the callback functions, to be able to access the parent Image class.
- Parameters
-
width | The image's width. |
height | The image's height. |
Definition at line 11 of file image_decoder.cpp.
◆ decoded_bytes_
uint32_t esphome::online_image::ImageDecoder::decoded_bytes_ = 0 |
|
protected |
◆ download_size_
uint32_t esphome::online_image::ImageDecoder::download_size_ = 1 |
|
protected |
◆ image_
OnlineImage* esphome::online_image::ImageDecoder::image_ |
|
protected |
◆ x_scale_
double esphome::online_image::ImageDecoder::x_scale_ = 1.0 |
|
protected |
◆ y_scale_
double esphome::online_image::ImageDecoder::y_scale_ = 1.0 |
|
protected |
The documentation for this class was generated from the following files: