modular-compositor

command
v0.1.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Example: Modular Compositor Pattern

Demonstrates how multiple independent "modules" render offscreen into images and a compositor displays them on a single GPU window. This pattern is used in smart mirrors, kiosk UIs, and digital signage where each panel is an independent process or goroutine.

Architecture:

[Clock Module goroutine]         -> channel -> [Compositor goroutine]
[Notification Module goroutine]  -> channel ->        |
                                              [gogpu Window]

In production, goroutines become separate processes communicating via Unix sockets or shared memory. Channels simulate the IPC for this example.

Each module uses offscreen.NewRenderer to render ui widgets into *image.RGBA without a window or GPU. The compositor receives frames via channels and composites them onto the window using gg.DrawImage.

Rendering: event-driven (ContinuousRender=false). Modules send frames only when content changes. The compositor redraws only when a new frame arrives.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL