ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::runtime_image::JpegDecoder Class Reference

Image decoder specialization for JPEG images. More...

#include <jpeg_decoder.h>

Inheritance diagram for esphome::runtime_image::JpegDecoder:
esphome::runtime_image::ImageDecoder

Public Member Functions

 JpegDecoder (RuntimeImage *image)
 Construct a new JPEG Decoder object.
 
 ~JpegDecoder () override
 
int HOT decode (uint8_t *buffer, size_t size) override
 
bool uses_direct_rgb565 () const
 
void draw_rgb565 (int x, int y, int w, int h, const uint8_t *pixels)
 
- 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 void reset ()
 Reset the decoder state, ending any decoding session.
 
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.
 
virtual bool is_finished () const
 Check if the decoder has finished processing.
 
virtual bool knows_end () const
 Whether is_finished() can tell a complete image from a cut-off one.
 

Protected Member Functions

bool prepare_rgb565_scaling_ (int width, int height)
 
- Protected Member Functions inherited from esphome::runtime_image::ImageDecoder
uint8_t * image_buffer_ () const
 The image's pixel buffer, for decoders that write their output straight into it.
 
bool image_is_big_endian_ () const
 

Protected Attributes

JPEGDEC jpeg_ {}
 
FixedVector< uint16_t > x_boundaries_ {}
 
FixedVector< uint16_t > y_boundaries_ {}
 
int source_width_ {0}
 
int source_height_ {0}
 
bool direct_rgb565_ {false}
 
- Protected Attributes inherited from esphome::runtime_image::ImageDecoder
double x_scale_ = 1.0
 
double y_scale_ = 1.0
 
RuntimeImage * image_
 
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 JPEG images.

Definition at line 14 of file jpeg_decoder.h.

Constructor & Destructor Documentation

◆ JpegDecoder()

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

Construct a new JPEG Decoder object.

Parameters
imageThe RuntimeImage to decode the stream into.

Definition at line 21 of file jpeg_decoder.h.

◆ ~JpegDecoder()

esphome::runtime_image::JpegDecoder::~JpegDecoder ( )
inlineoverride

Definition at line 22 of file jpeg_decoder.h.

Member Function Documentation

◆ decode()

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

Implements esphome::runtime_image::ImageDecoder.

Definition at line 123 of file jpeg_decoder.cpp.

◆ draw_rgb565()

void esphome::runtime_image::JpegDecoder::draw_rgb565 ( int x,
int y,
int w,
int h,
const uint8_t * pixels )

Definition at line 45 of file jpeg_decoder.cpp.

◆ prepare_rgb565_scaling_()

bool esphome::runtime_image::JpegDecoder::prepare_rgb565_scaling_ ( int width,
int height )
protected

Definition at line 19 of file jpeg_decoder.cpp.

◆ uses_direct_rgb565()

bool esphome::runtime_image::JpegDecoder::uses_direct_rgb565 ( ) const
inline

Definition at line 26 of file jpeg_decoder.h.

Field Documentation

◆ direct_rgb565_

bool esphome::runtime_image::JpegDecoder::direct_rgb565_ {false}
protected

Definition at line 37 of file jpeg_decoder.h.

◆ jpeg_

JPEGDEC esphome::runtime_image::JpegDecoder::jpeg_ {}
protected

Definition at line 32 of file jpeg_decoder.h.

◆ source_height_

int esphome::runtime_image::JpegDecoder::source_height_ {0}
protected

Definition at line 36 of file jpeg_decoder.h.

◆ source_width_

int esphome::runtime_image::JpegDecoder::source_width_ {0}
protected

Definition at line 35 of file jpeg_decoder.h.

◆ x_boundaries_

FixedVector<uint16_t> esphome::runtime_image::JpegDecoder::x_boundaries_ {}
protected

Definition at line 33 of file jpeg_decoder.h.

◆ y_boundaries_

FixedVector<uint16_t> esphome::runtime_image::JpegDecoder::y_boundaries_ {}
protected

Definition at line 34 of file jpeg_decoder.h.


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