why does the frambuf cannot use a memoryview as buf?
Posted: Sun Mar 13, 2022 1:37 pm
Hi,
the background of this question is that i believe the following code does allocate a new bytearray for every char it draws.
if i change the code to:
it fails with: TypeError: object with buffer protocol required
the background of this question is that i believe the following code does allocate a new bytearray for every char it draws.
Code: Select all
for i in range(len(text)):
glyph, H, W = self.font.get_ch(text[i])
cb = framebuf.FrameBuffer( bytearray(glyph[0:len(glyph)]) , W, H, framebuf.MONO_HLSB)
self.fb.blit(cb, o, 0)
o=o+W
Code: Select all
for i in range(len(text)):
glyph, H, W = self.font.get_ch(text[i])
cb = framebuf.FrameBuffer( glyph[0:len(glyph)] , W, H, framebuf.MONO_HLSB)
self.fb.blit(cb, o, 0)
o=o+W