Python API

Fonts and images

Bitmap font rendering, RGB565 bitmap access, and image conversion helpers.

Source snapshot: df47b3926b7c52e7f62eddbbf9dc618d6bbd6b6a.

Bitmap font rendering, RGB565 bitmap access, and image conversion helpers.

Every entry below is generated from a public binding table or header declaration and links to its immutable source line.

graphics.Font

class Font(font_data=None, height=0, cached=True)

Bitmap font loader and renderer for built-in, file, or buffer-backed glyph data.

View the pinned source declaration

graphics.Font.text

Font.text(canvas, text, x, y, color, scale=1, inverted=False)

Render bitmap text with selectable height, scale, and inversion.

View the pinned source declaration

graphics.Font.draw_char

Font.draw_char(char, x, y, canvas, color, scale=1, inverted=False)

Render one glyph through this Font onto a canvas.

View the pinned source declaration

graphics.Font.text_width

Font.text_width(text, scale=1)

Measure rendered text width at the selected scale.

View the pinned source declaration

graphics.Font.deinit

Font.deinit()

Release resources owned by the object.

View the pinned source declaration

graphics.Font.export

Font.export(filename)

Write cached font bytes to a file.

View the pinned source declaration

graphics.Font.width

Font.width

Width in pixels.

View the pinned source declaration

graphics.Font.height

Font.height

Height in pixels.

View the pinned source declaration

graphics.Font.font_name

Font.font_name

Font source name or the in-memory/default identifier.

View the pinned source declaration

graphics.BMP565

class BMP565(filename=None, source=None, streamed=False, mirrored=False, width=None, height=None)

RGB565 bitmap reader supporting buffered and streamed access.

View the pinned source declaration

graphics.BMP565.save

BMP565.save(filename=None)

Write the current image or bitmap to a versioned output path.

View the pinned source declaration

graphics.BMP565.deinit

BMP565.deinit()

Release resources owned by the object.

View the pinned source declaration

graphics.BMP565.width

BMP565.width

Width in pixels.

View the pinned source declaration

graphics.BMP565.height

BMP565.height

Height in pixels.

View the pinned source declaration

graphics.BMP565.buffer

BMP565.buffer

Backing pixel buffer when the object owns or exposes one.

View the pinned source declaration

graphics.BMP565.bpp

BMP565.bpp

Bitmap color depth in bits per pixel.

View the pinned source declaration

graphics.BMP565.BPP

BMP565.BPP

Bitmap storage width in bytes per pixel.

View the pinned source declaration

graphics.load_image

graphics.load_image(path)

Load a supported image file as a FrameBuffer.

View the pinned source declaration

graphics.save_image

graphics.save_image(framebuffer, path='screenshot')

Save a FrameBuffer to a versioned image path.

View the pinned source declaration

graphics.bmp_to_framebuffer

graphics.bmp_to_framebuffer(path)

Decode a BMP file into a FrameBuffer.

View the pinned source declaration

graphics.pbm_to_framebuffer

graphics.pbm_to_framebuffer(path)

Decode a PBM file into a FrameBuffer.

View the pinned source declaration

graphics.pgm_to_framebuffer

graphics.pgm_to_framebuffer(path)

Decode a PGM file into a FrameBuffer.

View the pinned source declaration