11 for (
int img_x = 0; img_x <
width_; img_x++) {
12 for (
int img_y = 0; img_y <
height_; img_y++) {
23 for (
int img_x = 0; img_x <
width_; img_x++) {
24 for (
int img_y = 0; img_y <
height_; img_y++) {
26 if (color.w >= 0x80) {
33 for (
int img_x = 0; img_x <
width_; img_x++) {
34 for (
int img_y = 0; img_y <
height_; img_y++) {
36 if (color.w >= 0x80) {
43 for (
int img_x = 0; img_x <
width_; img_x++) {
44 for (
int img_y = 0; img_y <
height_; img_y++) {
46 if (color.w >= 0x80) {
53 for (
int img_x = 0; img_x <
width_; img_x++) {
54 for (
int img_y = 0; img_y <
height_; img_y++) {
56 if (color.w >= 0x80) {
65 if (x < 0 || x >= this->
width_ || y < 0 || y >= this->
height_)
67 switch (this->
type_) {
85 if (this->
dsc_.data != this->data_start_) {
87 this->
dsc_.header.always_zero = 0;
88 this->
dsc_.header.reserved = 0;
94 this->
dsc_.header.cf = LV_IMG_CF_ALPHA_1BIT;
98 this->
dsc_.header.cf = LV_IMG_CF_ALPHA_8BIT;
102 this->
dsc_.header.cf = LV_IMG_CF_RGB888;
106 #if LV_COLOR_DEPTH == 16 107 this->
dsc_.header.cf = this->
has_transparency() ? LV_IMG_CF_TRUE_COLOR_ALPHA : LV_IMG_CF_TRUE_COLOR;
109 this->
dsc_.header.cf = LV_IMG_CF_RGB565;
114 #if LV_COLOR_DEPTH == 32 115 this->
dsc_.header.cf = LV_IMG_CF_TRUE_COLOR;
117 this->
dsc_.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
127 const uint32_t width_8 = ((this->
width_ + 7u) / 8u) * 8u;
128 const uint32_t pos = x + y * width_8;
132 const uint32_t pos = (x + y * this->
width_) * 4;
137 const uint32_t pos = (x + y * this->
width_) * 3;
152 pos += (x + y * this->
width_) * 3;
154 pos += (x + y * this->
width_) * 2;
157 auto r = (rgb565 & 0xF800) >> 11;
158 auto g = (rgb565 & 0x07E0) >> 5;
159 auto b = rgb565 & 0x001F;
161 Color color =
Color((r << 3) | (r >> 2), (g << 2) | (g >> 4), (b << 3) | (b >> 2), a);
166 const uint32_t pos = (x + y * this->
width_);
169 return Color(gray, gray, gray, alpha);
bool has_transparency() const
ImageType get_type() const
Color get_rgb24_pixel_(int x, int y) const
uint32_t get_width_stride() const
Return the stride of the image in bytes, that is, the distance in bytes between two consecutive rows ...
bool get_binary_pixel_(int x, int y) const
Color get_pixel(int x, int y, Color color_on=display::COLOR_ON, Color color_off=display::COLOR_OFF) const
Color get_grayscale_pixel_(int x, int y) const
int get_width() const override
Color get_rgb565_pixel_(int x, int y) const
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
const uint8_t * data_start_
lv_img_dsc_t * get_lv_img_dsc()
uint8_t progmem_read_byte(const uint8_t *addr)
int get_height() const override
void draw(int x, int y, display::Display *display, Color color_on, Color color_off) override
void draw_pixel_at(int x, int y)
Set a single pixel at the specified coordinates to default color.
Implementation of SPI Controller mode.
Image(const uint8_t *data_start, int width, int height, ImageType type)
Color get_rgba_pixel_(int x, int y) const