Skip to content

Revive drawing capabilities (new and improved!)#261

Open
cwervo wants to merge 6 commits intomainfrom
ac/drawing-may-2026
Open

Revive drawing capabilities (new and improved!)#261
cwervo wants to merge 6 commits intomainfrom
ac/drawing-may-2026

Conversation

@cwervo
Copy link
Copy Markdown
Collaborator

@cwervo cwervo commented May 7, 2026

This PR is a little large because it touches a bunch of drawing files. We get back a suite of drawing capabilities. This PR also has an unrelated change to running make remote when working out of a git worktree, happy to splice this into another PR.

Some examples of running the demo code via Wish $this runs demo code from builtin-programs/title.folk (which is a new wish added in this PR):

IMG_5693 Small IMG_5694 Small IMG_5695 Small IMG_5696 Small IMG_5697 Small IMG_5698 Small IMG_5699 Small IMG_5700 Small IMG_5701 Small

cwervo added 6 commits May 6, 2026 19:10
Use git rev-parse --git-path to choose the temporary ignore file for make sync/remote instead of assuming .git is a directory. Worktrees store .git as a file, so writing .git/ignores.tmp breaks remote deployment from branches checked out in a git worktree.
Move the remaining drawing primitive implementations out of the legacy display/root locations and into builtin-programs/draw. This keeps arc, curve, fill, and shape drawing alongside the rest of the new draw APIs.\n\nUpdate fill drawing to target a canvas explicitly, add has-demo-code snippets for the primitive programs, and adjust the README/demo examples to use meter-scale draw-shape values. Add focused draw primitive coverage for the moved APIs.
Add a draw-space library with vector, quad, projection, and display-length helpers for building display-space drawing demos from a page quad. Move the drawing primitives booklet entry into builtin-programs/draw/space.folk and make Wish <page> runs demo code from <program> evaluate that program's has-demo-code claim.\n\nTeach title.folk to pass drawing options through for titled, footnoted, left-margined, and right-margined text. Styled variants can now choose font, color, scale, anchor, and padding, while plain no-options wishes normalize through the same rendering path. Add demo coverage for the composite drawing demo, per-program demo execution, source-code left margins, and styled title/margin examples.
Rewrite connections.folk around quads instead of the old region helpers. Connection endpoints are resolved through quad vertices, projected into the target display, and rendered with the new draw line and fill triangle primitives.\n\nKeep the friendly shorthand wishes for static and dynamic connections while normalizing them into the explicit with from/to option form. Add regression coverage for centroid endpoints, option forwarding, display projection, and dynamic arrowhead placement.
Fix four-value text anchors so the block anchor places the whole text block and the line anchor only aligns each line inside that block. Previously the X offset subtracted the block offset again, so a left-aligned source-code block anchored on its right edge started at the margin point and spilled into the page.\n\nAdd a glyph-level regression test that draws multi-line Courier text with anchor {1.0 0.5 0.0 0.5} and checks the generated glyph instances stay to the left of the anchor point.
The live Folk machine may not have a public internet route, so fetching https://folk.computer/_media/logo.png can fail even though the URL is valid elsewhere. Bundle the small logo asset and resolve that well-known Folk media URL locally before falling back to curl.\n\nAlso harden URL downloads: preserve a useful extension for loader matching, write through a temporary file, reject empty downloads, and avoid leaving poisoned cache files behind after curl failures. Add a regression test for Wish <page> displays image "https://folk.computer/_media/logo.png".
@cwervo cwervo requested review from osnr and ppkn and removed request for osnr May 7, 2026 00:48
lassign $center cx cy
set points [list]
for {set i 0} {$i < $sides} {incr i} {
set theta [expr {$radians + $i * 2.0 * 3.141592653589793 / $sides - 1.5707963267948966}]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly surprised that there's no PI (or TAU) constants. Only slightly surprised though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I should definitely just expose PI and Tau globals

@ppkn
Copy link
Copy Markdown
Collaborator

ppkn commented May 7, 2026

I plan to test this out on my system today.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants