diff --git a/res/clock_icon.png b/res/clock_icon.png index 165bf51..b08bbfb 100644 Binary files a/res/clock_icon.png and b/res/clock_icon.png differ diff --git a/res/settings_icon.png b/res/settings_icon.png index d1141b0..c8e8019 100644 Binary files a/res/settings_icon.png and b/res/settings_icon.png differ diff --git a/res/torch_icon.png b/res/torch_icon.png index bbd4db3..aa5f514 100644 Binary files a/res/torch_icon.png and b/res/torch_icon.png differ diff --git a/wasp/apps/launcher.py b/wasp/apps/launcher.py index 274ea9c..4e76ab1 100644 --- a/wasp/apps/launcher.py +++ b/wasp/apps/launcher.py @@ -66,7 +66,7 @@ class LauncherApp(): if not app: return draw.set_color(0xffff) - draw.rleblit(app.ICON, (x+13, y+12)) + draw.blit(app.ICON, x+13, y+12) draw.set_color(0xbdb6) draw.string(app.NAME, x, y+120-30, 120) diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py index eece822..789454f 100644 --- a/wasp/apps/testapp.py +++ b/wasp/apps/testapp.py @@ -11,42 +11,8 @@ class TestApp(): NAME = 'Self Test' ICON = icons.app - # 2-bit RLE, generated from res/app_icon.png, 457 bytes - RLE_2BIT = ( - 96, 64, - b'\x1e@md> 16 self._display.fill(bg, x, y, w, h) + @micropython.native + def blit(self, image, x, y): + if len(image) == 3: + # Legacy 1-bit image + self.rleblit(image, (x, y)) + else: #elif image[0] == 2: + # 2-bit RLE image, (255x255, v1) + self._rle2bit(image, x, y) + @micropython.native def rleblit(self, image, pos=(0, 0), fg=0xffff, bg=0): """Decode and draw a 1-bit RLE image.""" @@ -135,14 +144,20 @@ class Draw565(object): color = bg @micropython.native - def rle2bit(self, image, x, y): + def _rle2bit(self, image, x, y): """Decode and draw a 2-bit RLE image.""" display = self._display quick_write = display.quick_write - (sx, sy, rle) = image + sx = image[1] + sy = image[2] + rle = memoryview(image)[3:] display.set_window(x, y, sx, sy) + if sx <= (len(display.linebuffer) / 2) and not bool(sy & 1): + sx *= 2 + sy /= 2 + palette = array.array('H', (0, 0xfffe, 0x7bef, 0xffff)) next_color = 1 rl = 0 diff --git a/wasp/icons.py b/wasp/icons.py index 76b5ee7..02c1b91 100644 --- a/wasp/icons.py +++ b/wasp/icons.py @@ -4,17 +4,125 @@ # 1-bit RLE, generated from res/battery.png, 189 bytes battery = (36, 48, b'\x97\x0e\x14\x12\x11\x14\x10\x14\x0c\x08\x0c\x08\x08\x08\x0c\x08\x08\x08\x0c\x08\x08\x08\x0c\x08\x08\x04\x14\x04\x08\x04\x14\x04\x08\x04\x0c\x04\x04\x04\x08\x04\x0b\x05\x04\x04\x08\x04\n\x06\x04\x04\x08\x04\t\x07\x04\x04\x08\x04\x08\x07\x05\x04\x08\x04\x07\x07\x06\x04\x08\x04\x06\x07\x07\x04\x08\x04\x05\x07\x08\x04\x08\x04\x04\x0e\x02\x04\x08\x04\x03\x0f\x02\x04\x08\x04\x02\x10\x02\x04\x08\x04\x02\x10\x02\x04\x08\x04\x02\x0f\x03\x04\x08\x04\x02\x0e\x04\x04\x08\x04\x08\x07\x05\x04\x08\x04\x07\x07\x06\x04\x08\x04\x06\x07\x07\x04\x08\x04\x05\x07\x08\x04\x08\x04\x04\x07\t\x04\x08\x04\x04\x06\n\x04\x08\x04\x04\x05\x0b\x04\x08\x04\x04\x04\x0c\x04\x08\x04\x14\x04\x08\x04\x14\x04\x08\x04\x14\x04\x08\x04\x14\x04\x08\x1c\x08\x1c\x08\x1c\x08\x1c\x98') -# 1-bit RLE, generated from res/app_icon.png, 441 bytes -app = (96, 64, b'\x1e$<$<$;&\x97,20/2-4,\x03.\x03,\x03.\x03,\x03.\x03,\x03.\x03,\x03.\x03,\x03\x0c\x03\x10\x03\x0c\x03,\x03\n\x07\x0c\x07\n\x03,\x03\t\x03\x02\x04\n\x04\x02\x03\t\x03,\x03\x08\x02\x07\x02\x08\x02\x07\x02\x08\x03,\x03\x07\x02\t\x02\x06\x02\t\x02\x07\x03,\x03\x06\x02\x0b\x02\x04\x02\x0b\x02\x06\x03,\x03\x06\x02\x0b\x02\x04\x02\x0b\x02\x06\x03,\x03\x05\x02\x0c\x02\x04\x02\x0c\x02\x05\x03,\x03\x05\x02\x0c\x02\x04\x02\x0c\x02\x05\x03,\x03\x05\x03\x0b\x02\x04\x02\x0b\x03\x05\x03,\x03\x06\x02\x0b\x02\x04\x02\x0b\x02\x06\x03,\x03\x06\x02\x0b\x02\x04\x02\x0b\x01\x07\x03,\x03\x07\x02\n\x02\x04\x02\n\x02\x07\x03+\x04\x08\x02\t\x02\x04\x02\t\x02\x08\x03*\x05\t\x0c\x04\x0c\t\x03*\x05\n\x0b\x04\x0b\n\x03*\x05.\x03*\x05.\x03*\x05.\x03*\x05.\x03*\x05\n\x0b\x04\x0b\n\x03+\x04\t\x0c\x04\x0c\t\x03,\x03\x08\x02\t\x02\x04\x02\t\x02\x08\x03,\x03\x07\x02\n\x02\x04\x02\n\x02\x07\x03,\x03\x06\x02\x0b\x02\x04\x02\x0b\x01\x07\x03,\x03\x06\x02\x0b\x02\x04\x02\x0b\x02\x06\x03,\x03\x05\x03\x0b\x02\x04\x02\x0b\x03\x05\x03,\x03\x05\x02\x0c\x02\x04\x02\x0c\x02\x05\x03,\x03\x05\x02\x0c\x02\x04\x02\x0c\x02\x05\x03,\x03\x06\x02\x0b\x02\x04\x02\x0b\x02\x06\x03,\x03\x06\x02\x0b\x02\x04\x02\x0b\x02\x06\x03,\x03\x07\x02\t\x02\x06\x02\t\x02\x07\x03,\x03\x08\x02\x07\x02\x08\x02\x07\x02\x08\x03,\x03\t\x03\x02\x04\n\x04\x02\x03\t\x03,\x03\n\x06\x0e\x06\n\x03,\x03\x0c\x03\x10\x03\x0c\x03,\x03.\x03,\x03.\x03,\x03.\x03,\x03.\x03,\x03.\x03,4-2/02,\x97&;$<$<$\x1e') +# 2-bit RLE, generated from res/app_icon.png, 460 bytes +app = ( + b'\x02' + b'`@' + b'\x1e@md