Draw
Source:
draw.h
BlobPath¶
src/light/draw.h:463One blob's orbit: where it sits at time t on a grid of w by h.
Public Attributes¶
uint8_t speedMul
: multiplies the shared time base, so blobs drift apart
uint8_t phaseX
: phase offset on x, keeping the paths from coinciding
uint8_t phaseY
Canvas¶
src/light/draw.h:45The surface a draw call writes to: a buffer plus the grid dimensions that address it.
Today every draw call takes (Buffer&, Coord3D dims) as two independent arguments that nothing checks for agreement: pass dims from one layer with a buffer from another, or (far likelier) a dims computed with the depth guard and one without, and the result is silent misaddressing. Binding them into one value makes the mismatch unrepresentable rather than merely detected.
It also owns the depth guard: depth() is 0 on a 2D layer, which would zero the z stride, so SIXTEEN effects each carry a private depthDim() helper. Constructing a [Canvas] applies it once.
Passed BY VALUE, deliberately. It is a small POD (pointer + 3 int16 + 2 small ints) and measured 62 instructions in a per-pixel fill loop against 67 for today's separate arguments and 69 for a const [Canvas]&: a reference member forces the extents to be re-read from memory because the compiler must assume they alias the buffer being written, while a by-value POD stays in registers. So the abstraction is not a cost here; it is a small win.
Public Attributes¶
uint8_t * data = nullptr
: first byte of the light array
size_t bytes = 0
: total writable bytes (the bound every write is clipped to)
Coord3D dims {0, 0, 0}
: logical extents; z is >= 1 (see the depth guard above)
uint8_t cpl = 3
: channels per light
Public Methods¶
inline size_t offsetOf(Coord3D p) const
: Byte offset of a coordinate, or bytes when it is outside the grid: the one address computation every draw call shares, so the addressing rule (x fastest, then y, then z) has a single home.
Public Static Methods¶
static inline Canvas of(Buffer & buf, lengthType w, lengthType h, lengthType d)
: Build from a Buffer + the layer's logical extents, applying the depth guard.
UpscaleTap¶
src/light/draw.h:1315One destination column's blend: the two source columns and the weight between them.
Public Attributes¶
uint16_t a
uint16_t b
uint16_t w
Sprite¶
src/light/draw.h:812A small movable bitmap: palette-indexed pixels (index 0 = the transparent key, the classic key-color scheme), frames stacked vertically (frame f = rows [fh, (f+1)h)).
Carried as constexpr data, the [fonts.h] shape. Full alpha (Porter-Duff over) stays deferred until a consumer needs it; a transparent index is what classic sprites used and what LED walls need.
Public Attributes¶
const uint8_t * pixels
const RGB * palette
uint8_t w
uint8_t h
uint8_t frames
uint8_t paletteCount