2017-12-11 22:00:16 -05:00
|
|
|
# test subclassing framebuf.FrameBuffer
|
|
|
|
|
|
|
|
try:
|
|
|
|
import framebuf
|
|
|
|
except ImportError:
|
2021-03-15 09:57:36 -04:00
|
|
|
print("SKIP")
|
2017-12-11 22:00:16 -05:00
|
|
|
raise SystemExit
|
|
|
|
|
2021-03-15 09:57:36 -04:00
|
|
|
|
2017-12-11 22:00:16 -05:00
|
|
|
class FB(framebuf.FrameBuffer):
|
|
|
|
def __init__(self, n):
|
|
|
|
self.n = n
|
|
|
|
super().__init__(bytearray(2 * n * n), n, n, framebuf.RGB565)
|
|
|
|
|
|
|
|
def foo(self):
|
|
|
|
self.hline(0, 2, self.n, 0x0304)
|
|
|
|
|
2021-03-15 09:57:36 -04:00
|
|
|
|
2017-12-11 22:00:16 -05:00
|
|
|
fb = FB(n=3)
|
|
|
|
fb.pixel(0, 0, 0x0102)
|
|
|
|
fb.foo()
|
|
|
|
print(bytes(fb))
|