Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage paintKit.package·originates fromworld 0a0b119f-a…

canvas

A paintable surface with a design: strokes, completion, quality, signing, scrubbing.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

canvas

A paintable surface with a design: strokes, completion, quality, signing, scrubbing.

A canvas is a grid of cells (cfg.cell metres) lying on a wall: u runs along it from its left edge, v up from its
foot. Each cell holds how full it is (0..1) and which pigment is on it. A stroke fills the cells whose centres
lie in its mark. The design says which pigment each cell should have; quality compares the two.

  local Canvas = require("~.modules.canvas")
  local c = Canvas.new(cfg, design)                       -- cfg: paintKit config; design: design.module
  local r = c:stroke({ u = 1.0, v = 1.2, radius = 0.16, pigment = "ochre", amount = 0.4,
                       spill = 0, maxV = 2.6, mask = nil })
  -- r = { touched, added }   cells touched and fill added (in cells). `mask = "teal"` paints only cells whose
  -- design pigment is teal (a stencil); `maxV` leaves cells above that height untouched (reach).
  local q = c:quality()
  -- q = { coverage, accuracy, overspray, tier ("masterwork" | ... | nil), score (0..1), painted (share of all
  --       design cells with any paint), byPigment = { ochre = { need, done } } }
  c:sign()            -- fixes the tier (returns it; nil if below the lowest tier: nothing is signed)
  c.signed, c.tier
  c:scrub(0.1)        -- removes that share of the design's cells' paint, top row first; returns the share left
  c.state             -- "blank" | "started" | "signed" | "scrubbed"
  c:cellAt(u, v)      -- col, row (or nil outside)        c:centre(col, row) -- u, v
  c:nextGap(pigment?) -- u, v of the lowest unfinished design cell (of that pigment), for guidance
  local text = c:serialise()      Canvas.restore(cfg, design, text)

Painting a different pigment over a cell keeps cfg.repaint.keep of its fill and changes its pigment, so going
over a mistake costs a second coat.

The interface is documented in the header of init.luau; this file repeats it for the asset browser.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

paintKit.modules.canvas — a paintable surface with a design: strokes, completion, quality, signing, scrubbing. A canvas is a grid of cells (cfg.cell metres) lying on a wall: u runs along it from its left edge, v up from its foot. Each cell holds how full it is (0..1) and which pigment is on it. A stroke fills the cells whose centres lie in its mark. The design says which pigment each cell should have; quality compares the two. local Canvas = require("~.modules.canvas") local c = Canvas.new(cfg, design) -- cfg: paintKit config; design: design.module local r = c:stroke({ u = 1.0, v = 1.2, radius = 0.16, pigment = "ochre", amount = 0.4, spill = 0, maxV = 2.6, mask = nil }) -- r = { touched, added } cells touched and fill added (in cells). `mask = "teal"` paints only cells whose -- design pigment is teal (a stencil); `maxV` leaves cells above that height untouched (reach). local q = c:quality() -- q = { coverage, accuracy, overspray, tier ("masterwork" | ... | nil), score (0..1), painted (share of all -- design cells with any paint), byPigment = { ochre = { need, done } } } c:sign() -- fixes the tier (returns it; nil if below the lowest tier: nothing is signed) c.signed, c.tier c:scrub(0.1) -- removes that share of the design's cells' paint, top row first; returns the share left c.state -- "blank" | "started" | "signed" | "scrubbed" c:cellAt(u, v) -- col, row (or nil outside) c:centre(col, row) -- u, v c:nextGap(pigment?) -- u, v of the lowest unfinished design cell (of that pigment), for guidance local text = c:serialise() Canvas.restore(cfg, design, text) Painting a different pigment over a cell keeps cfg.repaint.keep of its fill and changes its pigment, so going over a mistake costs a second coat.

new(cfg: any, design: any) → any

A blank canvas for a design.

argtypedescription
cfgany
designany

cellAt(u: number, v: number) → void

The cell under a point (u, v in metres), or nil outside the canvas.

argtypedescription
unumber
vnumber

centre(col: number, row: number) → void

The centre of a cell in metres.

argtypedescription
colnumber
rownumber

pigmentIndex(self: any, name: string) → number

argtypedescription
selfany
namestring

pigmentName(index: number) → string

The pigment name for an index stored on a cell (nil for 0).

argtypedescription
indexnumber

stroke(s: any) → any

Apply one mark. See the header for `s`. A signed canvas takes no paint.

argtypedescription
sany

quality( ) → any

Compare what is on the canvas with its design.

sign( ) → string

Fix the mural's tier. Returns the tier, or nil (and signs nothing) when it is below the lowest.

scrub(share: number) → number

Remove paint, top row first, from `share` of the design's cells. Returns the share of design cells still painted.

argtypedescription
sharenumber

nextGap(pigment: string?) → void

The centre (u, v) of the lowest, leftmost design cell not yet properly painted (optionally of one pigment).

argtypedescription
pigmentstring?

serialise( ) → string

The canvas as text: a header and run-length cells (pigment index and fill in tenths). For a save.

restore(cfg: any, design: any, text: string) → any

Rebuild a canvas from serialise()'s text. Returns nil when the text does not fit the design.

argtypedescription
cfgany
designany
textstring

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.