|
1 | 1 | # Github: https://github.com/funnygeeker/micropython-easydisplay
|
2 | 2 | # Author: funnygeeker
|
3 | 3 | # Licence: MIT
|
4 |
| -# Date: 2023/1/3 |
| 4 | +# Date: 2023/1/19 |
5 | 5 | #
|
6 | 6 | # 参考项目:
|
7 | 7 | # https://github.com/AntonVanke/micropython-ufont
|
|
16 | 16 |
|
17 | 17 | from io import BytesIO
|
18 | 18 | from struct import unpack
|
19 |
| -from framebuf import FrameBuffer, MONO_HLSB, RGB565 |
| 19 | +from framebuf import FrameBuffer, MONO_VLSB, MONO_HLSB, MONO_HMSB, RGB565, GS2_HMSB, GS4_HMSB, GS8 |
20 | 20 |
|
21 | 21 |
|
22 | 22 | class EasyDisplay:
|
| 23 | + MONO_VLSB = MONO_VLSB |
| 24 | + MONO_HLSB = MONO_HLSB |
| 25 | + MONO_HMSB = MONO_HMSB |
| 26 | + RGB565 = RGB565 |
| 27 | + GS2_HMSB = GS2_HMSB |
| 28 | + GS4_HMSB = GS4_HMSB |
| 29 | + GS8 = GS8 |
23 | 30 | BUFFER_SIZE = 32
|
24 | 31 |
|
25 | 32 | def __init__(self, display,
|
@@ -99,6 +106,47 @@ def __init__(self, display,
|
99 | 106 | if font:
|
100 | 107 | self.load_font(font)
|
101 | 108 |
|
| 109 | + # Framebuffer Function: https://docs.micropython.org/en/latest/library/framebuf.html |
| 110 | + def fill(self, *args, **kwargs): |
| 111 | + self.display.fill(*args, **kwargs) |
| 112 | + |
| 113 | + def pixel(self, *args, **kwargs): |
| 114 | + self.display.pixel(*args, **kwargs) |
| 115 | + |
| 116 | + def hline(self, *args, **kwargs): |
| 117 | + self.display.hline(*args, **kwargs) |
| 118 | + |
| 119 | + def vline(self, *args, **kwargs): |
| 120 | + self.display.vline(*args, **kwargs) |
| 121 | + |
| 122 | + def line(self, *args, **kwargs): |
| 123 | + self.display.line(*args, **kwargs) |
| 124 | + |
| 125 | + def rect(self, *args, **kwargs): |
| 126 | + self.display.rect(*args, **kwargs) |
| 127 | + |
| 128 | + def fill_rect(self, *args, **kwargs): |
| 129 | + self.display.fill_rect(*args, **kwargs) |
| 130 | + |
| 131 | + def scroll(self, *args, **kwargs): |
| 132 | + self.display.scroll(*args, **kwargs) |
| 133 | + |
| 134 | + def blit(self, *args, **kwargs): |
| 135 | + self.display.blit(*args, **kwargs) |
| 136 | + |
| 137 | + def ellipse(self, *args, **kwargs): |
| 138 | + self.display.ellipse(*args, **kwargs) |
| 139 | + |
| 140 | + def poly(self, *args, **kwargs): |
| 141 | + self.display.poly(*args, **kwargs) |
| 142 | + |
| 143 | + # Only partial screen driver support |
| 144 | + def circle(self, *args, **kwargs): |
| 145 | + self.display.circle(*args, **kwargs) |
| 146 | + |
| 147 | + def fill_circle(self, *args, **kwargs): |
| 148 | + self.display.fill_circle(*args, **kwargs) |
| 149 | + |
102 | 150 | def clear(self):
|
103 | 151 | """
|
104 | 152 | 清屏
|
|
0 commit comments