1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-15 01:32:19 +01:00

[image][online_image][animation] Fix transparency in RGB565 (#7631)

This commit is contained in:
Clyde Stubbs
2024-10-25 09:05:25 +11:00
committed by GitHub
parent 09f9d91577
commit 33fdbbe30c
15 changed files with 101 additions and 291 deletions

View File

@@ -215,16 +215,10 @@ void OnlineImage::draw_pixel_(int x, int y, Color color) {
}
case ImageType::IMAGE_TYPE_RGB565: {
uint16_t col565 = display::ColorUtil::color_to_565(color);
if (this->has_transparency()) {
if (col565 == 0x0020) {
col565 = 0;
}
if (color.w < 0x80) {
col565 = 0x0020;
}
}
this->buffer_[pos + 0] = static_cast<uint8_t>((col565 >> 8) & 0xFF);
this->buffer_[pos + 1] = static_cast<uint8_t>(col565 & 0xFF);
if (this->has_transparency())
this->buffer_[pos + 2] = color.w;
break;
}
case ImageType::IMAGE_TYPE_RGBA: {