Fit placeholder images with their aspect ratio #94

Merged
natsukium merged 1 commit from fix/placeholder-aspect into main 2026-10-12 00:11:33 +09:00
Owner

An image shown through Unicode-placeholder cells was stretched to fill the placement's c= by r= box: each cell got an equal slice of the image. kitty's grman_put_cell_image fits the image into the box with its aspect ratio kept, centers it, and gives each cell its share of that fitted rectangle, so margin cells show nothing.

  • placeholder_tile_quad cuts each quad from the fitted rectangle in pixel space; both cell edges come from the cell index, so neighbors share one boundary.
  • A property checks that a box's tiles stay inside their cells, cover exactly the fitted image, and sample it at one uniform scale.

Reproduced side by side with kitty: a 200×100 image in a 10×10 box now draws at 2:1, centered, as kitty draws it.

Closes #83

An image shown through Unicode-placeholder cells was stretched to fill the placement's `c=` by `r=` box: each cell got an equal slice of the image. kitty's `grman_put_cell_image` fits the image into the box with its aspect ratio kept, centers it, and gives each cell its share of that fitted rectangle, so margin cells show nothing. - `placeholder_tile_quad` cuts each quad from the fitted rectangle in pixel space; both cell edges come from the cell index, so neighbors share one boundary. - A property checks that a box's tiles stay inside their cells, cover exactly the fitted image, and sample it at one uniform scale. Reproduced side by side with kitty: a 200×100 image in a 10×10 box now draws at 2:1, centered, as kitty draws it. Closes #83
render: fit placeholder images with their aspect ratio
All checks were successful
darwin / detect relevant changes (pull_request) Successful in 8s
darwin / darwin docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m8s
windows / detect relevant changes (pull_request) Successful in 15s
windows / windows docs-only no-op (pull_request) Has been skipped
windows / cargo nextest (Windows) (pull_request) Successful in 3m44s
windows / frontend smoke (Windows) (pull_request) Successful in 50s
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been skipped
pr / nix flake check (pull_request) Successful in 38s
pr / cargo build / clippy / test / deny (pull_request) Successful in 2m19s
pr / wire schema is compatible with the base (pull_request) Successful in 4s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 27s
windows / cargo clippy (Windows cross) (pull_request) Successful in 14s
c5d9c97455
placeholder_tile_quad cut the image into c x r equal slices and
stretched each slice onto its cell, so an image whose shape differed
from the placement's cell box came out distorted. kitty's
grman_put_cell_image scales the image uniformly to fit the whole box,
centers it, and gives each cell its share of that fitted rectangle,
which leaves margin cells empty; the spec describes the same fit.

Each quad is now cut from the fitted rectangle in pixel space, with both
cell edges derived from the cell index so adjacent tiles share one
float boundary.

Closes #83

Assisted-by: Claude Code
natsukium force-pushed fix/placeholder-aspect from c5d9c97455
All checks were successful
darwin / detect relevant changes (pull_request) Successful in 8s
darwin / darwin docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m8s
windows / detect relevant changes (pull_request) Successful in 15s
windows / windows docs-only no-op (pull_request) Has been skipped
windows / cargo nextest (Windows) (pull_request) Successful in 3m44s
windows / frontend smoke (Windows) (pull_request) Successful in 50s
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been skipped
pr / nix flake check (pull_request) Successful in 38s
pr / cargo build / clippy / test / deny (pull_request) Successful in 2m19s
pr / wire schema is compatible with the base (pull_request) Successful in 4s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 27s
windows / cargo clippy (Windows cross) (pull_request) Successful in 14s
to 9f90d3eac2
Some checks failed
bench / Criterion full-suite snapshot (pull_request) Has been skipped
fuzz / cargo fuzz nightly long-run (pull_request) Has been skipped
darwin / detect relevant changes (pull_request) Successful in 8s
darwin / darwin docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m6s
fuzz / cargo fuzz smoke (per target) (pull_request) Successful in 1m38s
pr / nix flake check (pull_request) Failing after 20s
bench / Criterion regression gate (pull_request) Failing after 2m17s
pr / cargo build / clippy / test / deny (pull_request) Successful in 2m20s
pr / wire schema is compatible with the base (pull_request) Successful in 2s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 36s
windows / cargo clippy (Windows cross) (pull_request) Successful in 28s
windows / detect relevant changes (pull_request) Has been cancelled
windows / cargo nextest (Windows) (pull_request) Has been cancelled
windows / frontend smoke (Windows) (pull_request) Has been cancelled
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been cancelled
windows / windows docs-only no-op (pull_request) Has been cancelled
2026-10-11 00:42:51 +09:00
Compare
natsukium force-pushed fix/placeholder-aspect from 9f90d3eac2
Some checks failed
bench / Criterion full-suite snapshot (pull_request) Has been skipped
fuzz / cargo fuzz nightly long-run (pull_request) Has been skipped
darwin / detect relevant changes (pull_request) Successful in 8s
darwin / darwin docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m6s
fuzz / cargo fuzz smoke (per target) (pull_request) Successful in 1m38s
pr / nix flake check (pull_request) Failing after 20s
bench / Criterion regression gate (pull_request) Failing after 2m17s
pr / cargo build / clippy / test / deny (pull_request) Successful in 2m20s
pr / wire schema is compatible with the base (pull_request) Successful in 2s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 36s
windows / cargo clippy (Windows cross) (pull_request) Successful in 28s
windows / detect relevant changes (pull_request) Has been cancelled
windows / cargo nextest (Windows) (pull_request) Has been cancelled
windows / frontend smoke (Windows) (pull_request) Has been cancelled
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been cancelled
windows / windows docs-only no-op (pull_request) Has been cancelled
to a76b077d43
Some checks failed
darwin / detect relevant changes (pull_request) Successful in 9s
darwin / darwin docs-only no-op (pull_request) Has been skipped
pr / nix flake check (pull_request) Failing after 19s
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m8s
pr / cargo build / clippy / test / deny (pull_request) Successful in 2m22s
pr / wire schema is compatible with the base (pull_request) Successful in 3s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 26s
windows / cargo clippy (Windows cross) (pull_request) Successful in 13s
windows / detect relevant changes (pull_request) Has been cancelled
windows / cargo nextest (Windows) (pull_request) Has been cancelled
windows / frontend smoke (Windows) (pull_request) Has been cancelled
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been cancelled
windows / windows docs-only no-op (pull_request) Has been cancelled
2026-10-11 01:41:58 +09:00
Compare
natsukium force-pushed fix/placeholder-aspect from a76b077d43
Some checks failed
darwin / detect relevant changes (pull_request) Successful in 9s
darwin / darwin docs-only no-op (pull_request) Has been skipped
pr / nix flake check (pull_request) Failing after 19s
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m8s
pr / cargo build / clippy / test / deny (pull_request) Successful in 2m22s
pr / wire schema is compatible with the base (pull_request) Successful in 3s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 26s
windows / cargo clippy (Windows cross) (pull_request) Successful in 13s
windows / detect relevant changes (pull_request) Has been cancelled
windows / cargo nextest (Windows) (pull_request) Has been cancelled
windows / frontend smoke (Windows) (pull_request) Has been cancelled
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been cancelled
windows / windows docs-only no-op (pull_request) Has been cancelled
to 563d1c73e2
Some checks failed
windows / detect relevant changes (pull_request) Successful in 14s
bench / Criterion full-suite snapshot (pull_request) Has been skipped
fuzz / cargo fuzz nightly long-run (pull_request) Has been skipped
windows / windows docs-only no-op (pull_request) Has been skipped
windows / cargo nextest (Windows) (pull_request) Failing after 12s
windows / frontend smoke (Windows) (pull_request) Has been skipped
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been skipped
darwin / detect relevant changes (pull_request) Successful in 9s
darwin / darwin docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m8s
bench / Criterion regression gate (pull_request) Failing after 2m21s
fuzz / cargo fuzz smoke (per target) (pull_request) Successful in 1m58s
pr / nix flake check (pull_request) Failing after 23s
pr / wire schema is compatible with the base (pull_request) Successful in 2s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 36s
windows / cargo clippy (Windows cross) (pull_request) Successful in 14s
pr / cargo build / clippy / test / deny (pull_request) Successful in 3m17s
2026-10-11 23:26:34 +09:00
Compare
natsukium deleted branch fix/placeholder-aspect 2026-10-12 00:11:34 +09:00
Sign in to join this conversation.
No reviewers
No milestone
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
felis-terminal/felis!94
No description provided.