1
This commit is contained in:
10
display.py
10
display.py
@@ -83,3 +83,13 @@ class Display:
|
||||
self.tft.fill_rect(100, 240 - bar_height, 40, bar_height - last_bar_height, color)
|
||||
|
||||
return bar_height
|
||||
|
||||
def show_image(self, x, y, width, height, rgb565_data):
|
||||
"""在指定位置显示RGB565格式的图片数据"""
|
||||
if not self.tft: return
|
||||
|
||||
try:
|
||||
# 将字节数据转换为适合blit_buffer的格式
|
||||
self.tft.blit_buffer(rgb565_data, x, y, width, height)
|
||||
except Exception as e:
|
||||
print(f"Show image error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user