Skip to Content
sdeck docs

How drawing works

The framebuffer behind every deck.

Each deck keeps a framebuffer of what is on its LCD. As a result:

  • Sensor strips are cheap. The device can only draw them as part of a full-screen frame. A strip update re-encodes the framebuffer once instead of re-converting every key. Strip updates that arrive together, or while a frame is being sent, are merged into one frame.
  • Everything survives a strip redraw: key and window images, fillKey, fillScreen, setScreenImage and window regions. Only the low-level set*Jpeg methods bypass the framebuffer.
  • Unchanged updates are skipped. An image that would not change a pixel sends nothing, so re-rendering a page is close to free.
  • The last call wins. If two updates target the same slot, the later call is what ends up on screen, even if the earlier one finishes converting last.
  • You can read it back. deck.snapshot() returns a PNG and deck.readScreen(rect?) returns raw RGB. The draw event reports each region that reached the device.

Rendered elements arrive as exact-size raw RGBA. They are flattened in JS and never touch the image decoder.