Skip to main content

A Python package for high-performance GPU/CPU buffer rendering with support for tables, text, and graphics.

Project description

MatrixBuffer

MatrixBuffer is a Python package that provides a multiprocess-safe buffer for PyTorch tensors, specifically designed for rendering RGB matrices and tables using Pygame. This package allows for efficient sharing of tensor data between processes, making it suitable for applications that require real-time rendering and updates.

Features

  • Multiprocess Safe: Utilizes shared memory and locks to ensure safe access to tensor data across multiple processes.
  • Flexible Modes: Supports both numerical and RGB modes for tensor data.
  • Table Rendering: Built-in utilities to render structured tabular data directly on the screen.
  • Easy Integration: Designed to work seamlessly with Pygame for rendering visual data.

Installation

You can install the MatrixBuffer package using pip:

pip install matrixbuffer

Usage

Here is a simple example of how to use the MatrixBuffer package:

width, height = 640, 480
buffer = MultiprocessSafeTensorBuffer(n=height, m=width, mode="rgb")
buffer.write_matrix(torch.zeros((height,width,3), dtype=torch.uint8))

g = Graphics(width=width, height=height, bg_color=(30,30,30))

text1 = Text("Custom Rendering Engine!", x=50, y=50, font_size=32, color=(255,255,0))
table1 = Table(
    data=[["Name","Age"], ["Alice","24"], ["Bob","30"]],
    x=50, y=120, cell_width=120, cell_height=40,
    bg_color=(50,50,100), grid_color=(255,255,255)
)

text1.render_to_tensor(buffer)
table1.render_to_tensor(buffer)

g.run(buffer)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matrixbuffer-0.2.6.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matrixbuffer-0.2.6-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file matrixbuffer-0.2.6.tar.gz.

File metadata

  • Download URL: matrixbuffer-0.2.6.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for matrixbuffer-0.2.6.tar.gz
Algorithm Hash digest
SHA256 c9f33415efd5b8f1f5103b606c824e54d8a77fb16725e659c11c5f3e12f8aea1
MD5 1840e47f52d86a33c4c5370ff4e042c7
BLAKE2b-256 f9d9adde0d58217edffb8d36cb64e5dd58e04fa3a6150354607c3973122f63c8

See more details on using hashes here.

File details

Details for the file matrixbuffer-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: matrixbuffer-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for matrixbuffer-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3e00147d684b4559149aea8d01ff3ddcfde1eb1fc10b39f2cc6db0a29fcc7544
MD5 39ca4902deaff24f0eb4bd28c7728878
BLAKE2b-256 49ef075cc714983a4a23581b15046e237161e35239c91176eeb1e68d9d22fcb8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page