ESPHome 2026.8.0b4
Loading...
Searching...
No Matches
esphome::sendspin_::ArtworkDecodeSink Class Reference

Decode-only RuntimeImage that decodes into a buffer owned by SendspinImageSlot. More...

#include <sendspin_image.h>

Inheritance diagram for esphome::sendspin_::ArtworkDecodeSink:
esphome::runtime_image::RuntimeImage esphome::image::Image esphome::display::BaseImage

Public Member Functions

bool decoded_into (const uint8_t *buffer) const
 True when the decode ended with the given buffer still in place.
 
- Public Member Functions inherited from esphome::runtime_image::RuntimeImage
 RuntimeImage (ImageFormat format, image::ImageType type, image::Transparency transparency, image::Image *placeholder=nullptr, bool is_big_endian=false, int fixed_width=0, int fixed_height=0)
 Construct a new RuntimeImage object.
 
 ~RuntimeImage ()
 
int resize (int width, int height)
 Resize the image buffer to the requested dimensions.
 
void draw_pixel (int x, int y, const Color &color)
 
void map_chroma_key (Color &color)
 
int get_buffer_width () const
 
int get_buffer_height () const
 
void draw (int x, int y, display::Display *display, Color color_on, Color color_off) override
 
bool begin_decode (size_t expected_size=0)
 Begin decoding an image.
 
int feed_data (uint8_t *data, size_t len)
 Feed data to the decoder.
 
bool end_decode ()
 Complete the decoding process.
 
bool is_decoding () const
 Check if decoding is currently in progress.
 
bool is_decode_finished () const
 Check if the decoder has finished processing all data.
 
bool is_loaded () const
 Check if an image is currently loaded.
 
ImageFormat get_format () const
 Get the image format.
 
void release ()
 Release the image buffer and free memory.
 
bool set_external_buffer (uint8_t *buffer, int width, int height)
 Decode into a buffer the caller owns, instead of one allocated here.
 
size_t get_buffer_size (int width, int height) const
 Get the buffer size in bytes needed for a picture of the given dimensions.
 
void set_progressive_display (bool progressive)
 Set whether to allow progressive display during decode.
 
- Public Member Functions inherited from esphome::image::Image
 Image (const uint8_t *data_start, int width, int height, ImageType type, Transparency transparency)
 
Color get_pixel (int x, int y, Color color_on=display::COLOR_ON, Color color_off=display::COLOR_OFF) const
 
int get_width () const override
 
int get_height () const override
 
const uint8_t * get_data_start () const
 
ImageType get_type () const
 
int get_bpp () const
 
size_t get_width_stride () const
 Return the stride of the image in bytes, that is, the distance in bytes between two consecutive rows of pixels.
 
bool has_transparency () const
 
lv_image_dsc_t * get_lv_image_dsc ()
 
- Public Member Functions inherited from esphome::display::BaseImage

Additional Inherited Members

- Protected Member Functions inherited from esphome::runtime_image::RuntimeImage
size_t resize_buffer_ (int width, int height)
 Resize the image buffer to the requested dimensions.
 
void release_buffer_ ()
 Release only the image buffer without resetting the decoder.
 
int get_position_ (int x, int y) const
 Get the position in the buffer for a pixel.
 
std::unique_ptr< ImageDecodercreate_decoder_ ()
 Create decoder instance for the image's format.
 
- Protected Member Functions inherited from esphome::image::Image
bool get_binary_pixel_ (int x, int y) const
 
Color get_rgb_pixel_ (int x, int y) const
 
Color get_rgb565_pixel_ (int x, int y) const
 
Color get_grayscale_pixel_ (int x, int y) const
 
- Protected Attributes inherited from esphome::runtime_image::RuntimeImage
uint8_t * buffer_ {nullptr}
 
std::unique_ptr< ImageDecoderdecoder_ {nullptr}
 
const ImageFormat format_
 The image format this RuntimeImage is configured to decode.
 
int buffer_width_ {0}
 Actual width of the current image.
 
int buffer_height_ {0}
 Actual height of the current image.
 
size_t total_size_ {0}
 
size_t decoded_bytes_ {0}
 
const int fixed_width_ {0}
 Fixed width requested on configuration, or 0 if not specified.
 
const int fixed_height_ {0}
 Fixed height requested on configuration, or 0 if not specified.
 
image::Imageplaceholder_ {nullptr}
 Placeholder image to show when the runtime image is not available.
 
bool progressive_display_ {false}
 
bool is_big_endian_ {false}
 Whether the image is stored in big-endian format.
 
bool external_buffer_ {false}
 Whether buffer_ belongs to the caller, so it must not be freed or resized here.
 
- Protected Attributes inherited from esphome::image::Image
int width_
 
int height_
 
ImageType type_
 
const uint8_t * data_start_
 
Transparency transparency_
 
size_t bpp_ {}
 
size_t stride_ {}
 
lv_img_dsc_t dsc_ {}
 

Detailed Description

Decode-only RuntimeImage that decodes into a buffer owned by SendspinImageSlot.

Runs exclusively on the sendspin library's artwork decode thread. RuntimeImage's decode path overwrites the fields the display reads (data_start_/width_/height_), so it must never be the object shown on screen.

Definition at line 25 of file sendspin_image.h.

Member Function Documentation

◆ decoded_into()

bool esphome::sendspin_::ArtworkDecodeSink::decoded_into ( const uint8_t * buffer) const
inline

True when the decode ended with the given buffer still in place.

An external buffer is dropped rather than resized, so a decode that wanted other dimensions leaves the sink holding nothing. The JPEG and BMP decoders report that as a decode error, but the PNG decoder ignores it and reports success, so the outcome is checked here as well.

Definition at line 34 of file sendspin_image.h.


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