tools/sprite-silhouette: sprite alpha to CSS shape-outside polygon #8
Loading…
Reference in a new issue
No description provided.
Delete branch "libby/sprite-silhouette"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sprite alpha silhouette to a simplified polygon for CSS
shape-outside: polygon(), for Void's Ratatoskr pose bubbles. Zero dependencies (Node; PNG alpha read withnode:zlib). Entry:tools/sprite-silhouette/silhouette.mjs; first call, options, sample CSS and prior art (marching squares, potrace, Douglas-Peucker) are in its README. Ratatoskr is untouched; the poses directory is only read.Output: JSON keyed by pose id (
mind/label), each{width, height, points: [[x%, y%]...], css}. Defaults: alpha threshold 0.35, tolerance 1.5 px. Largest 8-connected shape only, holes ignored (one polygon is all shape-outside takes).Verified: 10 tests pass (
node --test tools/sprite-silhouette/silhouette.test.mjs): PNG filters, empty and fully opaque sprites, threshold edge (89 out, 90 in), simplified vs traced edge within tolerance both ways, holes, diagonal touch, islands, determinism, and all 99 catalogue poses. Not asserted by the suite: on all 99 poses at the defaults no polygon self-intersects (checked once). Not checked: how it looks in a browser.Point counts per pose at defaults (all 99; min 52, max 203, mean 106):
At tolerance 2: min 40, max 170, mean 87.
Not merged.
🤖 Generated with Claude Code
Maintainer sanity run at head
86faf53f:node --test tools/sprite-silhouette/silhouette.test.mjs10 pass, 0 fail, 0 skipped (the all-poses test ran against /opt/commons/cast-art/poses). Forge CI: 6 pending, 3 skipped (workflows waiting for a runner; none has ever started on this repo). Not merged, Void owns the client.