Skip to content

feat(image): fit a picture into a box, and scale its pixels - #118

Merged
mcereal merged 3 commits into
mainfrom
feat/image-scale
Nov 14, 2026
Merged

mcereal merged 3 commits into
mainfrom
feat/image-scale

Conversation

@mcereal

@mcereal mcereal commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

For inkos R8b (Photos): thumbnails in a grid and a picture on the viewer's page.

  • include/inkcell/ui/image.h, src/image.c. Pure: no panel and no allocation.

  • inkcell_image_fit(w, h, box, cover) says where the picture lands and which part of it shows. Contain fits all of it, centred. Cover fills the box and cuts the middle to the box's shape.

  • inkcell_image_scale_bgra() scales down with a box filter (the mean of the source pixels under each output pixel, with 64-bit sums) and up with the nearest pixel. Rows are by stride, so it can scale part of an image.

  • INKCELL_ICON_PHOTO (photo_library), for the grid's empty state. Only its sprite is appended: the font upstream has moved, and regenerating the whole table would change every other icon.

Tests: contain and cover in both orientations, a side of 0, a checkerboard averaged to grey, an upscale, and a stride wider than the row.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VUf1KjJ3LhZrw5yTNk8LqB

A photo is far larger than where it is shown, and inkcell_fb_blit_bgra
draws one for one. ui/image.h adds inkcell_image_fit() - contain or cover,
which part of the picture shows and where - and inkcell_image_scale_bgra(),
a box filter down and nearest pixel up, so a viewer scales once and blits
the result each frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VUf1KjJ3LhZrw5yTNk8LqB
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T20:14:49.959615Z
We couldn’t complete this review. Comment @codex review to try again.
51efe73 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

mcereal and others added 2 commits November 14, 2026 16:14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VUf1KjJ3LhZrw5yTNk8LqB
For a viewer's empty grid. Only the new sprite is added: regenerating the
whole table from today's Material Symbols moves every other sprite, so the
existing runs are kept as they were and photo_library's are appended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VUf1KjJ3LhZrw5yTNk8LqB
@mcereal
mcereal merged commit 13c8546 into main Nov 14, 2026
12 checks passed
@mcereal
mcereal deleted the feat/image-scale branch November 14, 2026 20:21
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.

1 participant