vtterm.render
Draw a Screen’s changed rows on a display.
Each row is composed in a strip buffer with pygraphics, one fill and one text
call per run of cells that share colors, then sent with one blit_rect.
Line-drawing cells aren’t in the font: they’re drawn as lines through the
middle of the cell, so boxes join from cell to cell at any font height.
When the display really scrolls (an SPI panel’s scroll registers, or a desktop
window that copies them), a whole-screen scroll moves the picture and only the
new rows are drawn. Other displays redraw the rows that moved.
- vtterm.render.scrolls_in_hardware(display)[source]
Return
Trueif settingdisplay.vscrollmoves the picture.The base display driver only stores the value. Drivers that act on it (SPI panels with scroll registers, the desktop and browser displays) override
vscsad.- Parameters:
display – A display driver.
- Returns:
bool – Whether the driver scrolls.
- class vtterm.render.Renderer(display, screen, font, palette=None, hardware_scroll=None)[source]
Bases:
objectDraws a screen’s dirty rows onto a display in RGB565.
- Parameters:
display – A display driver with
blit_rectand a 16-bitcolor_depth.screen (Screen) – The grid to draw.
font (Font) – A pygraphics font, 8 pixels wide.
palette (Palette) – Colors for the 256 ANSI indices, at 16 bits. Defaults to
AnsiPalette.hardware_scroll (bool) – Use the display’s scrolling.
None(default) asksscrolls_in_hardware.
- Raises:
ValueError – If the display isn’t 16-bit, or the screen doesn’t fit it.