namespaceRetained 2D Drawing3 functionsUI apps only
datumhue.draw
Retained-mode 2D vector graphics. Primitives persist across frames; center-origin, Y-up. Positions take a vec3 (z controls depth, -1000..1000) or a vec2 — without an explicit z, primitives auto-stack in creation order (later on top), and an explicit z is authoritative. Colors use Color values. For raster pixels — recorded pictures replayed onto an image's buffer (top-left origin, Y-down) — use image.
Create a draw canvas (render target). A mount that shows it larger than its size draws it again at that size, up to about four million pixels, so its shapes and text stay sharp. It keeps its own pixels with pixel_perfect, with filter set to nearest, and under the integer and sharp fits.
Create a detached text span. Attach it through the spans array of canvas:text() or prim:update(); it keeps its own color, size, weight and face there.
Example
local canvas = datumhue.draw.new({ width = 320, height = 240 })
canvas:mount({ width = 320, height = 240 })
local low = datumhue.draw.text_span({
text = "low",
color = datumhue.color("#e67e80"),
})
-- Spans follow the text, each in its own color and size.
canvas:text({
text = "Fuel: ",
color = datumhue.color("#7fbbb3"),
spans = { low },
})