feat(magicmap): PNG/APNG rendering and extract --gdat #405

Merged
jqueuniet merged 7 commits from feat/402-magicmap-render into main 2026-10-29 21:11:31 +01:00
Owner

Third of four stacked PRs for #402; based on the ornaments PR.

  • render_map_png: composites chips on the 8-px grid, scale, an animated APNG when anything animates (loop capped at 64 ticks, 166 ms per tick as a documented assumption), and a plain PNG otherwise.
  • Errors: console-family archive, byte-order mismatch, missing tileset, oversized canvas.
  • dm2 extract dungeon.dat -o out --gdat graphics.dat [--creatures] [--scale N] writes map_NN.png next to map_NN.json. Creatures are off by default. Whole-file errors abort before anything is written; per-map errors warn and continue.

Refs #402

https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw

Third of four stacked PRs for #402; based on the ornaments PR. - `render_map_png`: composites chips on the 8-px grid, scale, an animated APNG when anything animates (loop capped at 64 ticks, 166 ms per tick as a documented assumption), and a plain PNG otherwise. - Errors: console-family archive, byte-order mismatch, missing tileset, oversized canvas. - `dm2 extract dungeon.dat -o out --gdat graphics.dat [--creatures] [--scale N]` writes `map_NN.png` next to `map_NN.json`. Creatures are off by default. Whole-file errors abort before anything is written; per-map errors warn and continue. Refs #402 https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw
Composite each map's chips per tick with the ALPHA_A key and mirror
flags; loop over the least common multiple of cell periods (cap 64);
plain PNG for static maps. Expose Image::to_rgb_buffer.

Refs #402

Claude-Session: https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw
Writes map_NN.png beside map_NN.json for dungeon inputs.
Flags: --gdat, --creatures, --scale.

Refs #402

Claude-Session: https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw
It is already a regular dependency.

Refs #402

Claude-Session: https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw
BASE, SWIRL and the 7-px chip width are defined once in lib.rs.

Refs #402

Claude-Session: https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw
Lets later variants land without a breaking change.

Refs #402

Claude-Session: https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw
Callers reject 0; the library renders it as 1.

Refs #402

Claude-Session: https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw
docs(magicmap): describe the crate as a renderer
All checks were successful
CI / msrv (1.90) (pull_request) Successful in 46s
CI / audit (pull_request) Successful in 12s
CI / python bindings (3.11) (pull_request) Successful in 33s
CI / msrv (1.90) (push) Successful in 44s
CI / stable (push) Successful in 1m28s
CI / python bindings (3.11) (push) Successful in 33s
CI / stable (pull_request) Successful in 1m29s
CI / audit (push) Successful in 12s
3010f1d1e7
It renders PNG/APNG, not only chip selection.

Refs #402

Claude-Session: https://claude.ai/code/session_01WCNjYNkYSAapvFewz9wfkw
jqueuniet changed target branch from feat/402-magicmap-ornaments to main 2026-10-29 21:09:37 +01:00
jqueuniet deleted branch feat/402-magicmap-render 2026-10-29 21:11:31 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jqueuniet/dm2-tools!405
No description provided.