Show per-filter preview swatches in PhotosCrop Filters strip#305
Merged
Conversation
Each filter in the PhotosCrop Filters strip now renders a live thumbnail of the photo with that filter applied (Photos/Instagram-style), replacing the text-only pills. - New PhotosCropFilterThumbnailRenderer: a @Concurrent single-swatch renderer on a dedicated wide-gamut CIContext whose working/output color spaces match the editing canvas, so a swatch and the canvas resolve the same colors. Center- square-crops the session thumbnail, never upscales, and threads a source- relative radiusReferenceExtent so host blur/sharpen presets preview correctly. - Per-cell lazy rendering: each PhotosCropFilterChip renders its own swatch in a .task into its @State; a LazyHStack defers off-screen first renders and retains created chips, so scrolling never re-renders. No shared cache or dict. - Selected chip auto-centers via .scrollPosition(id:anchor:) on selection change. - Selection ring uses a dark shadow halo so it stays legible on bright swatches. - Swatches preview the filter only (not manual adjustments/blur/crop). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Each filter in the PhotosCrop Filters strip now renders a live thumbnail of the photo with that filter applied (Photos/Instagram-style), replacing the text-only pills — including an "Original" swatch.
How
PhotosCropFilterThumbnail.swift— a@concurrentsingle-swatch renderer on a dedicated wide-gamutCIContextwhose working/output color spaces match the editing canvas (extendedLinearDisplayP3→displayP3), so a swatch and the live canvas resolve the same colors. It center-square-crops the session thumbnail, never upscales past the source, and threads a source-relativeradiusReferenceExtentso host-supplied blur/sharpen presets preview at the correct strength.PhotosCropFilterChiprenders its own swatch in a.taskinto its@State. ALazyHStackdefers off-screen first renders and retains created chips, so scrolling never re-renders. No shared cache or stringly-typed dictionary..scrollPosition(id:anchor:)on selection change (clamps at the ends, so Original / the last filter rest at the edge).Notes
scrollPosition(id:anchor:)modifier (not deprecated). The iOS 18ScrollPositionstruct would needif #availablesince the deployment floor is iOS 17.Verification
🤖 Generated with Claude Code