ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::image::Image Class Reference

#include <image.h>

Inheritance diagram for esphome::image::Image:
esphome::display::BaseImage esphome::animation::Animation esphome::runtime_image::RuntimeImage esphome::sendspin_::ArtworkImageView esphome::online_image::OnlineImage esphome::sendspin_::ArtworkDecodeSink

Public Member Functions

 Image (const uint8_t *data_start, int width, int height, ImageType type, Transparency transparency, bool big_endian=false)
 big_endian is the RGB565 byte order; codegen writes little endian unless configured otherwise.
 
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.
 
void draw (int x, int y, display::Display *display, Color color_on, Color color_off) override
 
bool has_transparency () const
 
virtual lv_image_dsc_t * get_lv_image_dsc ()
 
virtual void add_lvgl_widget (lv_obj_t *obj)
 Called when an LVGL image widget is given this image.
 
- Public Member Functions inherited from esphome::display::BaseImage

Protected Member Functions

template<bool ROWS_OUTER>
void draw_ (int x, int y, display::Display *display, Color color_on, Color color_off, int x_start, int x_end, int y_start, int y_end)
 Per-pixel draw of the clipped range, rows (true) or columns (false) outer.
 
bool get_binary_pixel_ (int x, int y) const
 
Color get_rgb111_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

int width_
 
int height_
 
ImageType type_
 
const uint8_t * data_start_
 
Transparency transparency_
 
bool big_endian_
 
uint8_t bpp_ {}
 
lv_img_dsc_t dsc_ {}
 

Detailed Description

Definition at line 25 of file image.h.

Constructor & Destructor Documentation

◆ Image()

esphome::image::Image::Image ( const uint8_t * data_start,
int width,
int height,
ImageType type,
Transparency transparency,
bool big_endian = false )

big_endian is the RGB565 byte order; codegen writes little endian unless configured otherwise.

Definition at line 310 of file image.cpp.

Member Function Documentation

◆ add_lvgl_widget()

virtual void esphome::image::Image::add_lvgl_widget ( lv_obj_t * obj)
inlinevirtual

Called when an LVGL image widget is given this image.

An image whose size can change keeps the widget, so it can give the widget its source again when the size changes: the widget keeps the size it read from the descriptor.

Reimplemented in esphome::runtime_image::RuntimeImage.

Definition at line 51 of file image.h.

◆ draw()

void esphome::image::Image::draw ( int x,
int y,
display::Display * display,
Color color_on,
Color color_off )
overridevirtual

Implements esphome::display::BaseImage.

Reimplemented in esphome::runtime_image::RuntimeImage.

Definition at line 31 of file image.cpp.

◆ draw_()

template<bool ROWS_OUTER>
void esphome::image::Image::draw_ ( int x,
int y,
display::Display * display,
Color color_on,
Color color_off,
int x_start,
int x_end,
int y_start,
int y_end )
protected

Per-pixel draw of the clipped range, rows (true) or columns (false) outer.

Definition at line 82 of file image.cpp.

◆ get_binary_pixel_()

bool esphome::image::Image::get_binary_pixel_ ( int x,
int y ) const
protected

Definition at line 232 of file image.cpp.

◆ get_bpp()

int esphome::image::Image::get_bpp ( ) const
inline

Definition at line 36 of file image.h.

◆ get_data_start()

const uint8_t * esphome::image::Image::get_data_start ( ) const
inline

Definition at line 33 of file image.h.

◆ get_grayscale_pixel_()

Color esphome::image::Image::get_grayscale_pixel_ ( int x,
int y ) const
protected

Definition at line 293 of file image.cpp.

◆ get_height()

int esphome::image::Image::get_height ( ) const
overridevirtual

Implements esphome::display::BaseImage.

Definition at line 308 of file image.cpp.

◆ get_lv_image_dsc()

lv_image_dsc_t * esphome::image::Image::get_lv_image_dsc ( )
virtual

Reimplemented in esphome::runtime_image::RuntimeImage.

Definition at line 168 of file image.cpp.

◆ get_pixel()

Color esphome::image::Image::get_pixel ( int x,
int y,
Color color_on = display::COLOR_ON,
Color color_off = display::COLOR_OFF ) const

Definition at line 147 of file image.cpp.

◆ get_rgb111_pixel_()

Color esphome::image::Image::get_rgb111_pixel_ ( int x,
int y ) const
protected

Definition at line 237 of file image.cpp.

◆ get_rgb565_pixel_()

Color esphome::image::Image::get_rgb565_pixel_ ( int x,
int y ) const
protected

Definition at line 270 of file image.cpp.

◆ get_rgb_pixel_()

Color esphome::image::Image::get_rgb_pixel_ ( int x,
int y ) const
protected

Definition at line 250 of file image.cpp.

◆ get_type()

ImageType esphome::image::Image::get_type ( ) const

Definition at line 309 of file image.cpp.

◆ get_width()

int esphome::image::Image::get_width ( ) const
overridevirtual

Implements esphome::display::BaseImage.

Definition at line 307 of file image.cpp.

◆ get_width_stride()

size_t esphome::image::Image::get_width_stride ( ) const
inline

Return the stride of the image in bytes, that is, the distance in bytes between two consecutive rows of pixels.

Definition at line 40 of file image.h.

◆ has_transparency()

bool esphome::image::Image::has_transparency ( ) const
inline

Definition at line 43 of file image.h.

Field Documentation

◆ big_endian_

bool esphome::image::Image::big_endian_
protected

Definition at line 69 of file image.h.

◆ bpp_

uint8_t esphome::image::Image::bpp_ {}
protected

Definition at line 70 of file image.h.

◆ data_start_

const uint8_t* esphome::image::Image::data_start_
protected

Definition at line 67 of file image.h.

◆ dsc_

lv_img_dsc_t esphome::image::Image::dsc_ {}
protected

Definition at line 72 of file image.h.

◆ height_

int esphome::image::Image::height_
protected

Definition at line 65 of file image.h.

◆ transparency_

Transparency esphome::image::Image::transparency_
protected

Definition at line 68 of file image.h.

◆ type_

ImageType esphome::image::Image::type_
protected

Definition at line 66 of file image.h.

◆ width_

int esphome::image::Image::width_
protected

Definition at line 64 of file image.h.


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