ESPHome 2026.9.0-dev
Loading...
Searching...
No Matches
esphome::runtime_image::QoiDecoder Class Reference

Image decoder specialization for QOI images. More...

#include <qoi_decoder.h>

Inheritance diagram for esphome::runtime_image::QoiDecoder:
esphome::runtime_image::ImageDecoder

Public Member Functions

 QoiDecoder (RuntimeImage *image)
 Construct a new QOI decoder object.
 
void reset () override
 
int HOT decode (uint8_t *buffer, size_t size) override
 
bool is_finished () const override
 
- Public Member Functions inherited from esphome::runtime_image::ImageDecoder
 ImageDecoder (RuntimeImage *image, ImageFormat format)
 Construct a new Image Decoder object.
 
virtual ~ImageDecoder ()=default
 
ImageFormat get_format () const
 Get the image format handled by this decoder.
 
bool is_active () const
 Check if a decoding session is in progress (prepare() called, reset() not yet).
 
virtual int prepare (size_t expected_size)
 Initialize the decoder, starting a new decoding session.
 
bool set_size (int width, int height)
 Request the image to be resized once the actual dimensions are known.
 
void draw (int x, int y, int w, int h, const Color &color)
 Fill a rectangle on the display_buffer using the defined color.
 

Protected Attributes

std::unique_ptr< Color[]> color_table_
 
size_t current_index_ {0}
 
size_t paint_index_ {0}
 
size_t width_ {0}
 
size_t height_ {0}
 
Color last_pixel_ {0, 0, 0, 255}
 
uint16_t bits_per_pixel_ {0}
 
- Protected Attributes inherited from esphome::runtime_image::ImageDecoder
double x_scale_ = 1.0
 
double y_scale_ = 1.0
 
RuntimeImageimage_
 
size_t expected_size_ = 0
 
size_t decoded_bytes_ = 0
 
const ImageFormat format_
 
bool active_ = false
 
bool size_valid_ = true
 

Detailed Description

Image decoder specialization for QOI images.

Definition at line 16 of file qoi_decoder.h.

Constructor & Destructor Documentation

◆ QoiDecoder()

esphome::runtime_image::QoiDecoder::QoiDecoder ( RuntimeImage * image)
inline

Construct a new QOI decoder object.

Parameters
imageThe RuntimeImage to decode the stream into.

Definition at line 23 of file qoi_decoder.h.

Member Function Documentation

◆ decode()

int HOT esphome::runtime_image::QoiDecoder::decode ( uint8_t * buffer,
size_t size )
overridevirtual

QOI Header definition, for reference: char magic[4]; // magic bytes "qoif" uint32_t width; // image width in pixels (BE) uint32_t height; // image height in pixels (BE) uint8_t channels; // 3 = RGB, 4 = RGBA uint8_t colorspace; // 0 = sRGB with linear alpha, 1 = all channels linear

Implements esphome::runtime_image::ImageDecoder.

Definition at line 51 of file qoi_decoder.cpp.

◆ is_finished()

bool esphome::runtime_image::QoiDecoder::is_finished ( ) const
inlineoverridevirtual

Reimplemented from esphome::runtime_image::ImageDecoder.

Definition at line 28 of file qoi_decoder.h.

◆ reset()

void esphome::runtime_image::QoiDecoder::reset ( )
overridevirtual

Reimplemented from esphome::runtime_image::ImageDecoder.

Definition at line 38 of file qoi_decoder.cpp.

Field Documentation

◆ bits_per_pixel_

uint16_t esphome::runtime_image::QoiDecoder::bits_per_pixel_ {0}
protected

Definition at line 44 of file qoi_decoder.h.

◆ color_table_

std::unique_ptr<Color[]> esphome::runtime_image::QoiDecoder::color_table_
protected

Definition at line 38 of file qoi_decoder.h.

◆ current_index_

size_t esphome::runtime_image::QoiDecoder::current_index_ {0}
protected

Definition at line 39 of file qoi_decoder.h.

◆ height_

size_t esphome::runtime_image::QoiDecoder::height_ {0}
protected

Definition at line 42 of file qoi_decoder.h.

◆ last_pixel_

Color esphome::runtime_image::QoiDecoder::last_pixel_ {0, 0, 0, 255}
protected

Definition at line 43 of file qoi_decoder.h.

◆ paint_index_

size_t esphome::runtime_image::QoiDecoder::paint_index_ {0}
protected

Definition at line 40 of file qoi_decoder.h.

◆ width_

size_t esphome::runtime_image::QoiDecoder::width_ {0}
protected

Definition at line 41 of file qoi_decoder.h.


The documentation for this class was generated from the following files: