Skip to content

Commit 565ac63

Browse files
author
funnygeeker
committed
直通部分 framebuf 函数
1 parent d258dde commit 565ac63

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

lib/easydisplay.mpy

598 Bytes
Binary file not shown.

lib/easydisplay.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Github: https://github.com/funnygeeker/micropython-easydisplay
22
# Author: funnygeeker
33
# Licence: MIT
4-
# Date: 2023/1/3
4+
# Date: 2023/1/19
55
#
66
# 参考项目:
77
# https://github.com/AntonVanke/micropython-ufont
@@ -16,10 +16,17 @@
1616

1717
from io import BytesIO
1818
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
2020

2121

2222
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
2330
BUFFER_SIZE = 32
2431

2532
def __init__(self, display,
@@ -99,6 +106,47 @@ def __init__(self, display,
99106
if font:
100107
self.load_font(font)
101108

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+
102150
def clear(self):
103151
"""
104152
清屏

0 commit comments

Comments
 (0)