diff options
| author | Peter Hinch <peter@hinch.me.uk> | 2021-08-18 20:05:25 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-08-25 15:31:23 +1000 |
| commit | 2296df0a327150f39ef5a915bf828daac3cd4658 (patch) | |
| tree | ea791c3b6308ca854e1ea62442abc6b3ea2c4b19 /docs | |
| parent | 996f703166d8c57122756f35f7f0185666237f2b (diff) | |
extmod/modframebuf: Enable blit between different formats via a palette.
This achieves a substantial performance improvement when rendering glyphs
to color displays, the benefit increasing proportional to the number of
pixels in the glyph.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/library/framebuf.rst | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/docs/library/framebuf.rst b/docs/library/framebuf.rst index 0073ba708..13502cc7a 100644 --- a/docs/library/framebuf.rst +++ b/docs/library/framebuf.rst @@ -103,16 +103,23 @@ Other methods Shift the contents of the FrameBuffer by the given vector. This may leave a footprint of the previous colors in the FrameBuffer. -.. method:: FrameBuffer.blit(fbuf, x, y[, key]) +.. method:: FrameBuffer.blit(fbuf, x, y, key=-1, palette=None) Draw another FrameBuffer on top of the current one at the given coordinates. If *key* is specified then it should be a color integer and the corresponding color will be considered transparent: all pixels with that color value will not be drawn. - This method works between FrameBuffer instances utilising different formats, - but the resulting colors may be unexpected due to the mismatch in color - formats. + The *palette* argument enables blitting between FrameBuffers with differing + formats. Typical usage is to render a monochrome or grayscale glyph/icon to + a color display. The *palette* is a FrameBuffer instance whose format is + that of the current FrameBuffer. The *palette* height is one pixel and its + pixel width is the number of colors in the source FrameBuffer. The *palette* + for an N-bit source needs 2**N pixels; the *palette* for a monochrome source + would have 2 pixels representing background and foreground colors. The + application assigns a color to each pixel in the *palette*. The color of the + current pixel will be that of that *palette* pixel whose x position is the + color of the corresponding source pixel. Constants --------- |
