Commit Graph
173 Commits
Author SHA1 Message Date
Hector Villarreal 1beefac1ed Merge main into fix/mixer-load-solid-colors (conflicts as asked on the PR) 2026-11-09 23:46:36 -06:00
David Mann 009b93c5ed Merge pull request #12381 from RickiNano/fix/bg-eraser-cmyk-inks-12352
Background Eraser: a CMYK document compares against the picked inks (#12352)
2026-11-09 20:24:59 +01:00
David Mann b479d94e21 Merge pull request #11895 from RickiNano/fix/11887-catch-up-on-end-default
fix(paint): Catch-up on Stroke End starts unchecked (#11887)
2026-11-09 20:24:32 +01:00
RickiNano 658609f82c Background Eraser: picked swatch inks compare at the stored precision (#12352)
Typed inks between two 8-bit levels (30% cyan is stored as 77/255) missed
the pixels filled with them at a low Tolerance and left partial alpha.
Round them as the foreground already is.
2026-11-09 16:25:28 +01:00
RickiNano 44a3c25a9e Background Eraser: a CMYK document compares against the picked inks (#12352)
Protect Foreground Color and Sampling Background Swatch converted the
foreground and background from their sRGB stand-ins, so a colour picked
as CMYK inks (100/0/0/0) came back as other inks and pixels painted with
exactly those inks were erased or missed. BgEraseSettings now carries the
picked inks, as BrushSettings::color_cmyk does, and a CMYK target compares
against them while the colour is still that sRGB colour. RGB, Gray and Lab
documents are unchanged.
2026-11-09 07:00:26 +01:00
RickiNano cf2f496660 Format the #11887 tests 2026-11-08 22:01:12 +01:00
RickiNano 080d10c500 Brush: Catch-up on Stroke End starts unchecked, as in Photoshop (#11887)
Smoothing::default() now has catch_up_on_end: false, so after Reset Tool
a smoothed stroke ends short of the release point unless the option is
turned on. Tests that relied on the old default set it explicitly.
2026-11-08 22:01:12 +01:00
David MannandClaude Opus 5.5 f72fd4649e Merge origin/main into #12153: Protect Foreground narrows the graded Tolerance
main brought the graded erase (#11901), decontamination (#11902) and graded
Find Edges (#11904) into bg_erase.rs, and kept Protect Foreground Color on the
largest per-channel difference to the foreground. Resolved by narrowing the
Tolerance itself: with protection on, graded_weight runs on min(Tolerance,
distance from the sample to the foreground); a foreground equal to the sample
erases nothing. This replaces the distance stretch from before the merge.

Measured in the reference application with the issue's drag, foreground off in
two channels: (100,140,40) gives 0 32 75 112 156 196 238 255 (no protection),
(150,90,40) the block-5 row, (230,90,40) and (200,90,70) a Tolerance of 50
levels. So the narrowing uses the sample-match distance (largest increase plus
largest decrease), not the largest per-channel difference: the test on main
that kept the sampled colour for a two-channel foreground is replaced by these
rows. The reference rows of #11903 now match within 8 levels, 8- and 16-bit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:44:24 +01:00
Hector Villarreal 9390637f82 Mixer Brush: the load menu's and the setting's comments list Load Solid Colors Only and its key (eliets2 review on #12295) 2026-11-08 11:06:19 -06:00
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 Villarreal ea3afd57a6 Mixer Brush: Load Solid Colors Only in the load menu (#11952)
The Current Brush Load menu gets a separator and the checkable entry Load
Solid Colors Only, off by default and kept with the Mixer Brush's own brush
(MixerSettings.solid_colors_only). With it on, Alt+click loads the one
colour under the hotspot (paint.mixerLoad) instead of the sampled tip image;
off, it loads the tip image as before.
2026-11-07 22:56:23 -06: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
David MannandClaude Opus 5.5 6bd3773e07 Address CodeRabbit review: match the foreground at the document's precision, pin the protect-off row
The sampled colour is read from stored pixels, but the foreground was compared unrounded, so in
8- and 16-bit documents a foreground between two levels missed its own stored colour: Find Edges
erased it, and a foreground stored as the sample no longer protected anything. The foreground is
now rounded to the document's sample type first (32-bit float unchanged).

protect_off_is_unchanged now pins the whole alpha row, not only the first and last block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:40:59 +01:00
David MannandClaude Opus 5.5 a11204c677 Background Eraser: Protect Foreground Color fades with the distance (#11903)
Protect Foreground Color skipped every pixel within the whole Tolerance of
the foreground colour, the sampled colour included, so with a foreground
near the sample nothing was erased at all. It now narrows the Tolerance to
the distance between the sampled colour and the foreground colour: the
sample is still erased, the protection fades towards the sample, and the
foreground colour and colours beyond it are kept, as the reference
application does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 21:04:55 +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