diff --git a/boards/default_src/micropython_esp32s3/origin/build/lib/st7789_cf.py b/boards/default_src/micropython_esp32s3/origin/build/lib/st7789_cf.py index 96f70e55..a5b7adf1 100644 --- a/boards/default_src/micropython_esp32s3/origin/build/lib/st7789_cf.py +++ b/boards/default_src/micropython_esp32s3/origin/build/lib/st7789_cf.py @@ -37,35 +37,12 @@ class ST7789(uframebuf.FrameBuffer_Uincode): def display(self, data=None, x=None, y=None, rotation=0, sync=True): if type(data) is str: data = Image.open(data, rotation) - self._blit(data, x, y) + self.blit_rgb565(data.image, data.width, data.height, x, y) if sync: self.show() def screenshot(self): return IMG(memoryview(self._buffer), self.width, self.height) - def _blit(self, img, x=None, y=None): - '''考虑后期封装C模块,加快速度''' - if img.width == self.width and img.height == self.height: - self._buffer[:] = img.image - #大于屏幕图像 - elif img.width >= self.width and img.height >= self.height: - _x = ((img.width - self.width) // 2) if x is None else max(0, min(x, img.width - self.width)) - _y = ((img.height - self.height) // 2) if y is None else max(0, min(y, img.height - self.height)) - for line in range(self.height): - src_pos = ((_y + line) * img.width + _x) * 2 - dst_pos = line * self.width * 2 - self._buffer[dst_pos:dst_pos + self.width * 2] = img.image[src_pos:src_pos + self.width * 2] - #小于屏幕图像 - elif img.width <= self.width and img.height <= self.height: - _x = ((self.width - img.width) // 2) if x is None else max(0, min(x, self.width - img.width)) - _y = ((self.height- img.height) // 2) if y is None else max(0, min(y, self.height - img.width)) - for line in range(img.height): - src_pos = line * img.width * 2 - dst_pos = ((_y + line) * self.width + _x) * 2 - self._buffer[dst_pos:dst_pos + img.width * 2] = img.image[src_pos:src_pos + img.width * 2] - else: - raise ValueError("Unsupported image size for display") - def _write(self, cmd, dat=None): self.dc.off() self.spi.write(bytearray([cmd]))