fix ui
This commit is contained in:
@@ -40,6 +40,25 @@ void mimg_draw(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y, uint16_t
|
||||
}
|
||||
}
|
||||
|
||||
void mimg_draw_with_bg(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y, uint16_t color, uint16_t bg_color, const uint8_t *img, mimg_Area area) {
|
||||
uint8_t width_s1 = img[0]; // width - 1
|
||||
uint8_t height_s1 = img[1]; // height - 1
|
||||
uint8_t ix = min(area.x, width_s1);
|
||||
uint8_t iy = min(area.y, height_s1);
|
||||
uint8_t iw = min(area.w, width_s1 - ix + 1);
|
||||
uint8_t ih = min(area.h, height_s1 - iy + 1);
|
||||
uint8_t off_x, off_y;
|
||||
for (off_y = 0; off_y < ih; off_y ++) {
|
||||
for (off_x = 0; off_x < iw; off_x ++) {
|
||||
if (mimg_get_pixel_unsafe(img, ix + off_x, iy + off_y)) {
|
||||
set_pixel(x + off_x, y + off_y, color);
|
||||
} else {
|
||||
set_pixel(x + off_x, y + off_y, bg_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mimg_Area mimg_get_tile_area(const uint8_t *img, uint8_t cols, uint8_t rows, uint8_t index) {
|
||||
uint8_t width = img[0] + 1;
|
||||
uint8_t height = img[1] + 1;
|
||||
|
||||
Reference in New Issue
Block a user