circuitpython/tests/extmod/framebuf_blit.py.exp
Damien George b15348415e extmod/modframebuf: Add support for blit'ing read-only data.
Currently the `FrameBuffer.blit(buf, x, y)` method requires the `buf`
argument to be another `FrameBuffer`, which is quite restrictive because it
doesn't allow blit'ing read-only memory/data.

This commit extends `blit()` to allow the `buf` argument to be a tuple or
list of the form:

    (buffer, width, height, format[, stride])

where `buffer` can be anything with the buffer protocol and may be
read-only, eg `bytes`.

Also, the palette argument to `blit()` may be of the same form.

The form of this tuple/list was chosen to be the same as the signature of
the `FrameBuffer` constructor (that saves quite a bit of code size doing it
that way).

Signed-off-by: Damien George <damien@micropython.org>
2025-06-04 02:40:45 +10:00

45 lines
439 B
Text

--8<--
ff00000000
0000000000
0000000000
0000000000
-->8--
--8<--
ffff000000
ffff000000
0000000000
0000000000
-->8--
--8<--
0000000000
00ffff0000
00ffff0000
0000000000
-->8--
--8<--
0000000000
0000000000
0000000000
00000000ff
-->8--
--8<--
0000000000
0010110000
0012130000
0000000000
-->8--
--8<--
0000000000
0020210000
0022230000
0000000000
-->8--
--8<--
0000000000
00a1a20000
00a2a10000
0000000000
-->8--
ValueError
ValueError
ValueError