Skip to main content

Crate densa_draw

Crate densa_draw 

Source
Expand description

A frame’s display list, independent of any GPU API.

Painters draw through a Canvas: filled rectangles and glyphs (from a shared densa_text::GlyphCache) become Instances in an InstanceBuffer, one quad each, in the vertex layout densa-render uploads and draws in a single instanced draw call. Keeping the list GPU-free makes every painter testable without a GPU, and lets other backends draw the same list.

Drawing allocates nothing once the frame’s glyphs are cached.

Structs§

Canvas
One frame being drawn: everything painters emit goes through it.
CanvasState
A canvas’s translation and clip, saved with Canvas::state and brought back with Canvas::restore.
Color
A color in linear RGB with straight (not premultiplied) alpha: the space densa blends in.
Instance
One quad, as read by the vertex shader (per-instance step mode).
InstanceBuffer
Fixed-capacity instance list rebuilt every frame without allocating.
Point
A position in pixels, y down.
Rect
An axis-aligned rectangle in pixels, y down, stored as its four edges.
Size
A width and a height in pixels.