Skip to content

Add SVG viewing and sharp vector zoom - #2

Open
mrzv wants to merge 2 commits into
jrf:mainfrom
mrzv:svg-support
Open

mrzv wants to merge 2 commits into
jrf:mainfrom
mrzv:svg-support

Conversation

@mrzv

@mrzv mrzv commented Oct 5, 2026 •

Copy link
Copy Markdown

Changes

  • Add case-insensitive SVG discovery and viewing with resvg, including transparency, system fonts and relative local image references.
  • Rasterize thumbnails and fit views at their target size, and re-render SVG vectors at output resolution when zooming instead of enlarging an intrinsic-resolution bitmap.
  • Preserve SVG filter inputs outside the visible zoom viewport. Bound canvas and crop allocations together at 512 MiB and report allocation failures visibly.
  • Bypass persistent SVG thumbnail caching so referenced-file changes appear when reopening the gallery.

Commit grouping

This branch contains the two SVG commits, in order:

  1. [ai] Add SVG image viewing
  2. [ai] Preserve SVG vector detail when zooming

The two mouse/navigation commits are grouped afterward in #3; they are not part of this PR.

Verification

On this SVG-only branch:

  • cargo test: 33 passed.
  • cargo test --no-default-features: 32 passed.
  • cargo build and formatting check passed.
  • Real controlling-PTY smoke verified exact alternating black/white subpixel detail at 16x, keyboard pan/reset, off-viewport filter inputs, and clean terminal exits.

Verification decodes complete Kitty image transmissions; no live Kitty GUI was available.

Recognize SVG files in directory scans and rasterize them through the shared image decoder with resvg. Preserve transparency by converting premultiplied pixels to straight RGBA, resolve local image references relative to the SVG, and share a lazily loaded system font database. Fit renders use bounded dimensions without upscaling; zoom retains the existing intrinsic-raster path.

Bypass the persistent SVG thumbnail cache because its source-only key cannot track referenced images or system fonts. Apply the standard image decoder allocation budget before creating SVG raster buffers so excessive intrinsic dimensions return an error instead of aborting allocation, while bounded thumbnails and fit renders remain possible.

Add rendering, resource, cache freshness, allocation-limit and file-discovery coverage, update dependencies, and document SVG usage and raster zoom behavior.

Model: openai-codex/gpt-6.1-sol:high
Keep parsed SVG trees as fullscreen zoom sources instead of magnifying
intrinsic-resolution bitmaps. Re-render each SVG view at its output pixel
resolution with continuous crop geometry, retaining fractional detail and
matching mouse pan displacement. Leave raster crop/resize behavior intact.

Render filtered SVGs on a full zoomed canvas before cropping so effects
retain inputs outside the viewport. Preserve fractional alignment, budget
canvas and crop allocations together, and report rendering failures in the
viewer with recovery when the zoom or viewport changes. Unfiltered SVGs
continue to allocate only the visible viewport.

Add regressions for fine vector detail, fractional pan and transparency,
offscreen filter inputs, allocation limits and recovery. Update SVG viewing
documentation to describe vector zoom and filtered rendering limits.

Model: openai-codex/gpt-6.1-sol:high
@mrzv mrzv changed the title Add SVG image viewing Add SVG viewing and sharp vector zoom Oct 5, 2026
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