Repository navigation
Filters read the toolbox, a map file and the active path - #70
Merged
Merged
Conversation
The last three functional gaps, closed. Every "a filter here cannot see that" in the README was a decision about the plugin API rather than about the filters, so the API changed. `FilterContext` is what a filter is handed beyond its own pixels and numbers: the foreground and background colours, what the document composites to underneath, an image somebody picked, and the active path flattened into the filter's own coordinates. `apply_with` replaces `apply_over`, `wants_map` and `wants_path` join `wants_backdrop`, and a filter that asks for nothing still implements one method. **The toolbox colours.** The whole Sketch group draws in them -- ink is the foreground, paper the background -- as do Clouds, Difference Clouds, Fibers, Tiles' gaps, Neon Glow's glow, Colored Pencil's paper and Diffuse Glow's glow. With the swatches at their defaults that is black on white, exactly as before, which is why the group has looked right until now; set them to sepia and Stamp comes out as a sepia print, which it could not before at any setting. **A displacement map.** Displace takes the file Photoshop asks for, red for horizontal and green for vertical with mid grey meaning stay, and stretched or tiled. The dialog grew a Choose button that decodes through the same codecs that open documents, so a map can be a PSD, a PNG or anything else this build reads. With no map it still falls back to its own noise field. **The active path.** Flame burns along it, each flame leaving the curve at right angles to it, and the licks are sampled in the flame's own frame so they run up it whichever way it points. With no path they rise from the bottom of the selection as before. **A depth map.** Lens Blur can take one from the layer's transparency or from what is underneath, holding part of the picture at its original sharpness -- Photoshop's Depth Map, minus the channel picker. Two things fell out. The filter dialog gave a choice's name the same 56 pixels it gives a number, so "Repeat Edge Pixels" wrapped onto three lines; choices now take room from their own track, which they barely need. And Flame's last root sat exactly on the last point of the path, where there is no segment ahead of it -- so its direction was (0, 0), its normal was nothing, and it set the entire frame alight. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.
The last three functional gaps, closed. Every "a filter here cannot see that" left in the README was a decision about the plugin API, not about the filters — so the API changed.
FilterContextis what a filter gets beyond its own pixels and numbers: the two toolbox colours, what the document composites to underneath, an image somebody picked, and the active path flattened into the filter's own coordinates.apply_withreplacesapply_over,wants_mapandwants_pathjoinwants_backdrop, and a filter that asks for nothing still implements one method.The toolbox colours
The whole Sketch group draws in them — ink is the foreground, paper the background — as do Clouds, Difference Clouds, Fibers, Tiles' gaps, Neon Glow's glow, Colored Pencil's paper and Diffuse Glow's glow.
With the swatches at their defaults that is black on white, exactly as before, which is why the group has looked right until now. Set them to sepia and Stamp comes out as a sepia print — which it could not do before at any setting.
A displacement map
Displace takes the file Photoshop asks for: red for horizontal, green for vertical, mid grey meaning stay, stretched to fit or tiled. The dialog grew a Choose button that decodes through the same codecs that open documents, so a map can be a PSD, a PNG, or anything else this build reads. With no map it still falls back to its own noise field, and says so.
The active path
Flame burns along it, each flame leaving the curve at right angles to it, and the licks are sampled in the flame's own frame rather than the picture's so they run up it whichever way it points. With no path they rise from the bottom of the selection as before.
A depth map
Lens Blur can take one from the layer's transparency or from what is underneath it, holding part of the picture at its original sharpness — Photoshop's Depth Map, minus the channel picker.
Two things fell out
acrosswas zero everywhere, and it set the entire frame alight. Caught by rendering it; the fix takes the segment behind, and a zero-length segment now means straight up.Checked
New tests: that the two-tone filters actually use the colours they are given (handed red and blue, nothing may come out green), and that Displace moves pixels where its map says and leaves them where it says stay. Full workspace suite green, clippy and rustfmt clean. Every changed filter eyeballed — sepia Stamp, cream-paper Colored Pencil, blue-and-cream Clouds, a warm Diffuse Glow, Displace through a real map, Flame along an arc. And the app driven headlessly to confirm the Displace dialog's Choose row and that the long choice names now fit.
The README's "here is what a filter cannot see" paragraph is gone. What remains is ergonomic, not functional: Photoshop puts blur pins, light gizmos and flame paths on the canvas; here they are position sliders and the path you already drew.
🤖 Generated with Claude Code