Skip to content

fill: inside(X) floods the outside of concave shapes; documented seed is not wired #16

Open

Description

@scbrown
{ type: "palette", name: "p", colors: { _: "transparent", bone: "#e6dccd", outline: "#000000" } }
{ type: "sprite", name: "cup", size: [10, 10], palette: "p", regions: {
    outline: { z: 1, line: [[0, 0], [3, 0], [3, 6], [6, 6], [6, 0], [9, 0], [9, 9], [0, 9], [0, 0]] },
    bone: { z: 0, fill: "inside(outline)" },
} }

The seed is the centre of the boundary's bounding box, or the nearest free
pixel to it. For the "U" that pixel is in the notch, so bone fills the notch
and leaks out of the top of the canvas, and the inside of the U stays empty.
The docs offer seed: [x, y], but RegionDef.seed is the u32 jitter seed
and flood_fill is always called with None. A related problem: a fill
nested inside union/intersect isn't deferred the way a top-level fill is,
so it can run before its boundary exists and fill the whole canvas.
Workaround: the cranium keeps its fill (its centre is inside). The
mandible is concave, so its interior is a path polygon with the same vertices
as its outline. Every fill is top-level.

Found while drawing examples/skull (#13). The repro is checked against main.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions