ESPHome  2025.2.0
Public Member Functions | Protected Attributes
esphome::online_image::BmpDecoder Class Reference

Image decoder specialization for PNG images. More...

#include <bmp_image.h>

Inheritance diagram for esphome::online_image::BmpDecoder:
esphome::online_image::ImageDecoder

Public Member Functions

 BmpDecoder (OnlineImage *image)
 Construct a new BMP Decoder object. More...
 
int HOT decode (uint8_t *buffer, size_t size) override
 
- Public Member Functions inherited from esphome::online_image::ImageDecoder
 ImageDecoder (OnlineImage *image)
 Construct a new Image Decoder object. More...
 
virtual ~ImageDecoder ()=default
 
virtual int prepare (size_t download_size)
 Initialize the decoder. More...
 
bool set_size (int width, int height)
 Request the image to be resized once the actual dimensions are known. More...
 
void draw (int x, int y, int w, int h, const Color &color)
 Fill a rectangle on the display_buffer using the defined color. More...
 
bool is_finished () const
 

Protected Attributes

size_t current_index_ {0}
 
ssize_t width_ {0}
 
ssize_t height_ {0}
 
uint16_t bits_per_pixel_ {0}
 
uint32_t compression_method_ {0}
 
uint32_t image_data_size_ {0}
 
uint32_t color_table_entries_ {0}
 
size_t width_bytes_ {0}
 
size_t data_offset_ {0}
 
- Protected Attributes inherited from esphome::online_image::ImageDecoder
OnlineImageimage_
 
size_t download_size_ = 1
 
size_t decoded_bytes_ = 0
 
double x_scale_ = 1.0
 
double y_scale_ = 1.0
 

Detailed Description

Image decoder specialization for PNG images.

Definition at line 14 of file bmp_image.h.

Constructor & Destructor Documentation

◆ BmpDecoder()

esphome::online_image::BmpDecoder::BmpDecoder ( OnlineImage image)
inline

Construct a new BMP Decoder object.

Parameters
displayThe image to decode the stream into.

Definition at line 21 of file bmp_image.h.

Member Function Documentation

◆ decode()

int HOT esphome::online_image::BmpDecoder::decode ( uint8_t *  buffer,
size_t  size 
)
overridevirtual

BMP file format: 0-1: Signature (BM) 2-5: File size 6-9: Reserved 10-13: Pixel data offset

Integer values are stored in little-endian format.

BMP DIB header: 14-17: DIB header size 18-21: Image width 22-25: Image height 26-27: Number of color planes 28-29: Bits per pixel 30-33: Compression method 34-37: Image data size 38-41: Horizontal resolution 42-45: Vertical resolution 46-49: Number of colors in the color table

Implements esphome::online_image::ImageDecoder.

Definition at line 14 of file bmp_image.cpp.

Field Documentation

◆ bits_per_pixel_

uint16_t esphome::online_image::BmpDecoder::bits_per_pixel_ {0}
protected

Definition at line 29 of file bmp_image.h.

◆ color_table_entries_

uint32_t esphome::online_image::BmpDecoder::color_table_entries_ {0}
protected

Definition at line 32 of file bmp_image.h.

◆ compression_method_

uint32_t esphome::online_image::BmpDecoder::compression_method_ {0}
protected

Definition at line 30 of file bmp_image.h.

◆ current_index_

size_t esphome::online_image::BmpDecoder::current_index_ {0}
protected

Definition at line 26 of file bmp_image.h.

◆ data_offset_

size_t esphome::online_image::BmpDecoder::data_offset_ {0}
protected

Definition at line 34 of file bmp_image.h.

◆ height_

ssize_t esphome::online_image::BmpDecoder::height_ {0}
protected

Definition at line 28 of file bmp_image.h.

◆ image_data_size_

uint32_t esphome::online_image::BmpDecoder::image_data_size_ {0}
protected

Definition at line 31 of file bmp_image.h.

◆ width_

ssize_t esphome::online_image::BmpDecoder::width_ {0}
protected

Definition at line 27 of file bmp_image.h.

◆ width_bytes_

size_t esphome::online_image::BmpDecoder::width_bytes_ {0}
protected

Definition at line 33 of file bmp_image.h.


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