48 if (buffer[0] !=
'B' || buffer[1] !=
'M') {
49 ESP_LOGE(TAG,
"Not a BMP file");
54 size_t file_size =
encode_uint32(buffer[5], buffer[4], buffer[3], buffer[2]);
84 ESP_LOGE(TAG,
"Invalid image dimensions: (%zdx%zd)", this->
width_, this->
height_);
105 size_t header_size =
encode_uint32(buffer[17], buffer[16], buffer[15], buffer[14]);
106 size_t offset = 14 + header_size;
115 buffer[offset + i * 4 + 1], buffer[offset + i * 4]);
130 ESP_LOGE(TAG,
"Unsupported bits per pixel: %d", this->
bits_per_pixel_);
147 size_t width =
static_cast<size_t>(this->
width_);
148 while (index <
size) {
151 size_t remaining_in_row = width -
x;
152 uint8_t pixels_in_byte = std::min<size_t>(remaining_in_row, 8);
153 bool end_of_row = remaining_in_row <= 8;
155 if (index + needed >
size) {
159 uint8_t current_byte = buffer[index];
160 for (uint8_t i = 0; i < pixels_in_byte; i++) {
162 this->
draw(x + i,
y, 1, 1, c);
176 size_t width =
static_cast<size_t>(this->
width_);
177 size_t last_col = width - 1;
178 while (index <
size) {
182 if (index + needed >
size) {
187 uint8_t color_index = buffer[index];
189 ESP_LOGE(TAG,
"Invalid color index: %u", color_index);
194 uint8_t b = rgb & 0xff;
195 uint8_t g = (rgb >> 8) & 0xff;
196 uint8_t r = (rgb >> 16) & 0xff;
209 size_t width =
static_cast<size_t>(this->
width_);
210 size_t last_col = width - 1;
211 while (index <
size) {
215 if (index + needed >
size) {
219 uint8_t b = buffer[index];
220 uint8_t g = buffer[index + 1];
221 uint8_t r = buffer[index + 2];
234 ESP_LOGE(TAG,
"Unsupported bits per pixel: %d", this->
bits_per_pixel_);