Commit Graph
161 Commits
Author SHA1 Message Date
David Mann b11e866957 Merge branch 'fix/11904-bg-eraser-find-edges-graded' into fix/11902-bg-eraser-decontamination
# Conflicts:
#	crates/paint/src/bg_erase.rs
2026-11-08 15:14:07 +01:00
David MannandClaude Opus 5.5 1d5d94cf17 Background Eraser: document that Find Edges grades in this tool
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:13:28 +01:00
David Mann ec76a8f08a Merge branch 'fix/11901-bg-eraser-graded-alpha' into fix/11904-bg-eraser-find-edges-graded 2026-11-08 15:13:00 +01:00
David MannandClaude Opus 5.5 cbdce347f0 Background Eraser: Protect Foreground keeps the per-channel distance; tolerance doc
Only the sample match uses the measured increase-plus-decrease distance (#11901).
Protect Foreground Color keeps today's largest per-channel difference, as #11903
asks for its unmeasured cases. The tolerance doc describes the new distance and
the graded falloff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:12:49 +01:00
David Mann a65a23f829 Merge remote-tracking branch 'origin/main' into fix/11901-bg-eraser-graded-alpha 2026-11-08 15:10:31 +01:00
Hector VillarrealandClaude Opus 5.5 1cf1e15da5 Keep Lab/16 Color Replacement on the RGB blend (CodeRabbit review on crates/paint/src/replace.rs:101)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 21:41:31 -06:00
Hector Villarreal 7efd224081 Color Replacement: in Lab, Color keeps L and takes the foreground's a and b (#11922)
In a Lab document the Color mode no longer blends through RGB (which
changed the pixel's L): it keeps the stored L and moves a and b to the
foreground's, as in the reference application. Hue, Saturation and
Luminosity keep today's RGB blend.
2026-11-07 20:25:05 -06:00
David MannandClaude Opus 5.5 6d3fe6f96f Background Eraser: partly erased pixels lose the sampled colour's tint (#11902)
A dab that erases a pixel only partly now also removes the sampled
colour's share from it: the kept colour becomes
(c - sampled x (1 - keep)) / keep per channel, clipped to the channel
range, so composited over the sampled colour it gives back the
original. Later dabs, in the same stroke and in later strokes, match
the pixel's current, decontaminated colour; sampling and the
Contiguous fill still read the pixels before the stroke. With the
graded alpha of #11901 this gives the reference application's drag
results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 02:51:01 +01:00
David MannandClaude Opus 5.5 23f63c685e Background Eraser: Find Edges erases soft edges graded instead of cutting them hard (#11904)
Find Edges used to give every pixel within the Tolerance full weight,
so on a blurred edge it erased more than Contiguous. It now uses the
same graded weight (#11901), which keeps the transition as the
reference application does and still gives the Contiguous result on a
hard edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 02:34:46 +01:00
David MannandClaude Opus 5.5 22882f690c Background Eraser: alpha falls off over the whole Tolerance (#11901)
One dab now erases a colour less the further it is from the sampled
colour, over the whole Tolerance, instead of fully up to the last
quarter of it. The weight is 1 - clamp((d - d0) / (T - d0), 0, 1) with
d0 = min(T / 20, 8 levels), measured with single clicks in the
reference application. The colour distance is the largest increase
plus the largest decrease over the channels, so opposite-sign changes
add up. Find Edges keeps its hard cut (#11904).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 02:24:08 +01:00
FredApps 3fc577e203 Merge pull request #11155 from vangel76/perf/paint-dab-walk-stream
Paint: stream the dab generator's steps, keep NaN brush values and points out (#11137)
2026-11-07 15:40:26 +01:00
FredApps 4933fee59c Merge pull request #11147 from vangel76/perf/paint-mixer-sample-rect
perf(paint): Mixer Sample All Layers reads only the dab rectangle
2026-11-07 15:40:21 +01:00
FredApps 7d363b91ea Merge pull request #11142 from vangel76/perf/11130-texture-wrap
Brush: Texture at a scale other than 100% samples about 1.6x faster, same pixels
2026-11-07 15:40:15 +01:00
Hartmut Nörenberg ccc263e49e fix(paint): Pressure for Size starts off, as the reference does
BrushSettings::default() turned Pressure for Size on, so a fresh brush -
and the brush Reset Tool hands back, which is that default plus
Photoshop's 10 % smoothing - reported pressureSize: true from brush.get
and drew the options bar's "Always use pressure for size" button
highlighted, while the reference application leaves both pressure
toggles off after Reset Tool. Neither is on now.

The toggle itself is untouched: it still switches both ways, Shape
Dynamics' Pen Pressure control is unaffected, and path.stroke's Simulate
Pressure still tapers a brush that follows pen pressure. A brush JSON
that omits pressureSize now reads as off, as the reference's default is.

Two engine tests took their expectation from the old default and set
pressureSize explicitly instead: cmd::brush_cmds::tests::stroke_backwards_compatible
and cmd::vector_cmds::tests::stroke_path_simulate_pressure_tapers_both_ends.
The new crates/engine/src/brush_pressure_size_default_tests.rs covers the
default, brush.get on a fresh session, an omitted field, switching the
toggle, and that a pressure ramp with the default brush paints like
pressureSize: false.

Fixes #11809
2026-11-07 07:22:59 +01:00
David Mann 9922871a4e Merge pull request #11148 from vangel76/perf/paint-procedural-texture-cache
perf(paint): cache procedural brush textures between strokes
2026-11-06 23:20:44 +01:00
David Mann ad55badcb8 Merge pull request #11146 from vangel76/perf/paint-retouch-smudge-selection
perf(paint): Smudge start-up and selection sampling without per-pixel work
2026-11-06 23:20:17 +01:00
c441fd350c perf(paint): sampled, textured and wet-edge dabs rasterize on all cores (#11369)
* perf(paint): sampled, textured and wet-edge dabs rasterize on all cores (#11350)

The general dab loop runs its rows on the thread pool, with the same pixels as serially.
It reaches the pool from about 16,000 pixels, a quarter of the round path's threshold.

* test(paint): the parallel-vs-serial depth test checks colour, not alpha, for painted pixels

The opaque background's alpha (1.0) is 0.5 away from 0.5, so the check
passed even if nothing was painted (CodeRabbit on #11369).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(paint): read pixels with as_chunks (clippy chunks_exact_to_as_chunks)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 22:40:33 +01:00
Khawar Zamman Wani 41cb536813 perf(paint): cache sampled-tip mipmaps between strokes (#9617)
Thanks @wanikhawar — merging.

**Summary:** Sampled brush tip mip pyramids are reused across strokes and symmetry through a bounded LRU (64 entries / 256 MiB); Edit ▸ Purge All releases the cache. Bench + purge/render tests lock the behaviour.
2026-11-05 12:27:06 +01:00
Khawar Zamman Wani b3fd0159ec perf(paint): create a large dab's new coverage tiles on the workers (#11349)
Each new coverage tile zeroes 16 KB. The parallel path of
CoverageMap::accumulate did that on the calling thread while building
its work list, so a large dab's new tiles ran one at a time. Create
them inside the parallel section instead.

coverage_bench gains a large-dab line (3457x3457, what a soft 2000 px
tip covers). big_dab_bench's "accumulate" figure is relabelled: it is
a cold first push minus a warm rasterize, not accumulate alone.

Refs #11339
2026-11-05 04:05:21 +01:00
vangel76andClaude Sonnet 5.5 0d69d40c6b perf(paint): key the pattern cache on normalised levels, make the eviction test independent
The key now uses the brightness and contrast values Texture::level uses (clamped, non-finite as 0, -0.0 as 0.0), so equal levels share one entry. The cache logic moves into a PatternCache struct so the eviction test runs on its own instance instead of the shared static.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 01:51:30 +01:00
vangel76andClaude Sonnet 5.5 93d41f434f paint: test NaN dual hardness and spacing fall back to the defaults
CodeRabbit review point: the dual-brush fallbacks in bounded_for_render were not covered.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 00:18:52 +01:00
vangel76andClaude Sonnet 5.5 c2a6a80b1f paint: refresh a duplicate pattern-cache key; test eviction and key separation
CodeRabbit review points: a duplicate insert should promote the entry, the key-separation test could pass after the base entry was evicted, and the entry limit was untested.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 00:18:41 +01:00
vangel76andClaude Sonnet 5.5 5ee9f56139 paint: test that Smudge::dab leaves a zero-channel region alone
CodeRabbit review point: the zero-channel early return was not covered.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 00:18:35 +01:00
vangel76andClaude Sonnet 5.5 247deb7a15 paint: take the slow wrap path for texture sides past i32::MAX; test texture_at on a scaled texture
CodeRabbit review points: the i32 rem_euclid in sample_bilinear_wrap differs from sample_wrap for sides past i32::MAX, and nothing checked the x/y argument order at the texture_at call.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 00:18:34 +01:00
vangel76andClaude Sonnet 5.5 af025e18d5 paint: replace only NaN brush values, test a long pixel-grid segment
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 20:30:34 +01:00
vangel76andClaude Sonnet 5.5 f5e92a6b3d paint: stream the dab generator's steps and keep non-finite brush values and points out
DabGenerator::walk collected every step of a segment into a Vec before building
dabs (up to 1e7 steps in the pixel-grid mode). The steps now become dabs as the
walker emits them. Non-finite opacity, flow, hardness and spacing fall back to the
defaults in bounded_for_render, and the smoother drops points without a finite
position.

Refs #11137

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 20:28:50 +01:00
vangel76andClaude Sonnet 5.5 acd35e1202 Guard zero-channel regions and saturate the pick-up bounds in Smudge
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 19:53:53 +01:00
vangel76andClaude Sonnet 5.5 c7e82529fe perf(paint): Mixer sample reads only the dab rectangle (#11133)
apply_mixer_dab read and converted the whole stroke working rectangle for every dab when a sample surface was given, which made Sample All Layers strokes quadratic. It now reads fp.rect clipped to the working rectangle, which is all apply_mixer_dab_region reads. Pixels are unchanged. Refs #11133.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 19:51:34 +01:00
vangel76andClaude Sonnet 5.5 9df4cd395c perf(paint): Smudge start-up and selection sampling without per-pixel work (#11132)
Smudge writes its carry buffer straight into place (no Vec per pixel) and picks up row by row; mix_back and apply_coverage read the selection one row at a time instead of one tile lookup per pixel. Output is bit-identical, tests compare against the previous per-pixel code. Refs #11132.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 19:51:02 +01:00
vangel76andClaude Sonnet 5.5 90e1e359f1 perf(paint): cache procedural brush textures between strokes (#11134)
BrushContext::new regenerated the procedural texture and re-applied its levels for every stroke and every symmetry pass. A bounded LRU (4 entries, 16 MiB) keyed by style, size, seed and the level settings returns the identical image. Refs #11134.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 19:50:53 +01:00
vangel76andClaude Sonnet 5.5 643786fdd8 test(paint): cover every special coordinate on both axes
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 19:46:47 +01:00
vangel76andClaude Sonnet 5.5 6a2baca3d6 perf(paint): wrap the Texture pattern once per axis in bilinear sampling (#11130)
Texture at a scale other than 100% made four sample_wrap calls per pixel,
eight rem_euclid in all. Wrap the two columns and rows once and read the four
texels directly; same bits out, with a test against the old four-call form.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 19:46:02 +01:00
FredApps 0f120bbda1 Merge current main, reconcile streamed PNG profiles and workflow inputs 2026-10-30 06:52:05 +01:00
FredApps 7c05ffe243 Keep packed-key overlap expression within repository formatting style 2026-10-29 14:41:10 +01:00
FredApps f72b2ccab1 Reconcile stroke touches with packed coverage tile keys
Preserve both sparse and bounded-rectangle overlap paths after integrating #9852 with current main. Existing touches_covers_every_pixel_with_coverage covers negative coordinates, edges and huge rectangles. Combined CI will validate; no local build claimed.
2026-10-29 14:40:31 +01:00
FredApps 53dbfe280c Integrate 16 reviewed performance and usability PRs
Includes #8472 #8488 #9461 #9793 #9809 #9813 #9814 #9822 #9826 #9847 #9850 #9852 #9921 #9924 #9961 #10080 at reviewed heads.

Preserves each PR head as a parent. Reconciles CI workflow inputs and benchmark jobs without dropping checks. Excludes #8536 #9825 #9969 #10129. Combined CI pending; no manual validation claimed.
2026-10-29 14:31:15 +01:00
FredApps 32f583f1d6 Merge approved PhotoCraft PR #5082: fix(mixer-brush): Alt-click samples the foreground colour like the Brush (#4873)
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Preserve current spatial Mixer Brush Alt-click sampling and live transaction architecture; add compatible point-sample command without foreground mutation. Retain sample across automatic reload until foreground changes and preserve all new regressions.
2026-10-29 06:05:02 +01:00
FredApps a72296ee57 Merge approved PhotoCraft PR #6139: Fix painting workflows, File Info and layer selection
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Ported Behind paint across engine/render and shared options-bar/canvas mode menus, preserving Clear and current popup ownership. Added localized responsive picker title/width and File Info multiline fields without dropping ordered fields, Browse or camera metadata; ported Pen anchor repositioning, copy cursor, grayscale-target sampling and authorized select-under-cursor dispatch into current modules with original regressions.
2026-10-29 05:39:00 +01:00
FredApps d24410da75 Merge approved PhotoCraft PR #9623: Pencil: keep a 1 px freehand line connected where it turns 2026-10-29 03:30:04 +01:00
Khawar Zamman Wani 5f03f1424b perf(paint): skip dry mixer canvas sampling 2026-10-28 08:09:49 +05:30
Dylan M. Taylor 2b0b11848c Refactor paint for strict Clippy checks 2026-10-27 23:47:06 +00:00
David Mann 3a689f217c Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	crates/engine/src/file_cmds.rs
#	crates/engine/src/retouch_cmds.rs
#	crates/engine/src/vector_cmds.rs
#	crates/io/src/psd_export.rs
#	crates/io/src/psd_import.rs
#	crates/io/src/smart_map.rs
#	crates/psd/src/layer.rs
#	crates/raster/src/lib.rs
#	crates/ui-egui/src/camera_raw_ui.rs
#	crates/ui-egui/src/canvas.rs
#	crates/ui-egui/src/filter_dialog.rs
#	crates/ui-egui/src/gpu_canvas.rs
#	crates/ui-egui/src/panels.rs
#	crates/ui-egui/src/retouch_ui.rs
#	crates/ui-egui/src/transform_tool.rs
#	crates/ui-egui/src/vector_ui.rs
#	docs/gaps.md
2026-10-27 14:26:26 +01:00
David Mann 89489082cc Merge PR #8923: fix(ui): Remove Tool trail tints all a stroke removes; brush trails follow hardness (#8916) 2026-10-27 14:01:28 +01:00
ac9b374fab Integration: Remove trail shows thin strokes on big documents (#8923)
The trail mask is at most 1024 px on its long side, so on a big document
one mask pixel stands for k x k document pixels, and the Remove trail
sampled only each block's centre. A thin stroke that fell between the
centres (2 px on 6000x4000, k = 6; 4 px on 12000x8000, k = 12) showed no
tint at all, though every pixel it touched is removed. In reach mode a
mask pixel now takes the largest coverage of its whole block, clipped to
the document. Blocks no coverage tile reaches are skipped
(StrokeRenderer::touches), so releasing a whole stroke on a 30000x20000
document restamps in 0.22 s instead of 23 s.

Also pins the waiting strokes' kept tint where a later stroke restamps
its rectangle off its own path (fails with the base max removed).

Co-authored-by: Hartmut Nörenberg <55043719+hnoerenberg@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 13:57:20 +01:00
Khawar Zamman Wani cc6837355b perf(paint): accumulate serial dabs in place with packed tile keys 2026-10-27 18:26:47 +05:30
Khawar Zamman Wani 47df5dedea perf(paint): cache round-tip geometry per dab 2026-10-27 18:10:05 +05:30
Khawar Zamman Wani 325421a28b perf(paint): keep rotated circular tips on the round fast path 2026-10-27 17:20:39 +05:30
aiongg b3a8bf65b1 refactor(paint): move render_reference.rs to render/reference.rs 2026-10-26 22:30:14 +00:00
aiongg ffd8333999 refactor(paint): move mixer_reference_tests.rs to mixer/reference_tests.rs 2026-10-26 22:30:14 +00:00
NetterSilverandClaude Opus 5.5 652075f4da Pencil: keep a 1 px freehand line connected where it turns
Fixes #8040

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 07:57:16 +01:00