Commit Graph
4 Commits
Author SHA1 Message Date
Hector VillarrealandClaude Opus 5.5 61a413d8df Feather: reserve every line buffer before blurring
CodeRabbit on #9493 (inline 4371628901): a worker whose line buffers
couldn't be reserved left its rows unblurred while the rest of the plane
was blurred, a half-feathered mask the cache would keep. Every worker's
buffers (rows and columns) are now reserved, with the transpose, before
the plane is touched; failing that, the sequential path runs, which also
reserves first and otherwise leaves the plane as it was.

Test: a_failed_line_buffer_never_leaves_a_half_blurred_mask

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 11:12:24 -06:00
Hector VillarrealandClaude Opus 5.5 3fb2b2853f Feather: pad each line past the edge, not the whole plane
CodeRabbit on #9493 (inline 4371565312): the edge halo was built as a
padded copy of the whole plane, 3(r + 1) samples a side; at a 1000 px
feather a 6000 × 6000 mask needed a 12000 × 12000 plane and its transpose,
far past the 512 MiB working-set budget. Each row, then each column, is
now continued past its ends on its own, which gives exactly the same
result: the blur needs the plane's transpose and one padded line per
worker, and the per-worker buffers are reserved fallibly.

Tests: a_maximum_feather_does_not_pad_the_whole_plane (largest buffer
for a 400 × 400 plane was 40,960,000 floats before),
padding_each_line_matches_padding_the_plane (bitwise)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 10:57:22 -06:00
Hector VillarrealandClaude Opus 5.5 02f8d3a5e4 fix(vector): a mask feather continues the mask past the canvas edge (#9475)
The feather blur clamped every one of its box passes at the plane's
edge. Where the canvas cut a feathered mask off, each pass repeated the
already blurred values there, brightening the edge (12 levels at a
32 px feather) and making the result depend on the canvas size.
The blur now pads the plane with its edge values by the passes' reach,
blurs, and keeps the original area, which matches Photoshop within one
level both for a mask black at the edge and one white up to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 10:36:43 -06:00
David MannandClaude Opus 5.5 6bb45c8d5b Shapes: Density and Feather on shape layers (#5846)
A shape layer's path is its vector mask in Photoshop (Properties > Masks),
with its own vector-mask density and feather. PhotoCraft's ShapeLayer had
neither, so soft shapes could not be made, and stroked soft shapes from PSDs
lost both on import.

- doc: ShapeLayer gains `density` (0..1, default 1) and `feather` (px,
  default 0).
- vector: the shape renderer applies them to the fill as a soft vector mask
  (fill shows beyond the path at 1 - density; the feather is the vector
  mask's Gaussian), so the shape's own pixels, the GPU (which samples them)
  and the stroke/fill split all follow. The stroke stays crisp. The feather
  blur moves from compose::masks to vector::feather and both share it and the
  feathered area, so a shape and an equal vector mask render the same pixels.
- compose: soft shapes' bounds reach their fill, their layer effects follow
  the soft alpha, and the split cache key includes density and feather.
- engine: `layer.vectorMask.edit` on a shape layer sets density/feather in one
  history step (path/enabled/linked/invert are refused there); density is now
  validated (finite 0..100) instead of clamped. `layer.vectorMask.info`
  reports a shape's values.
- ui: Properties shows the Vector Mask Density and Feather sliders for a
  selected shape layer in both themes (live drag, one undo per gesture).
- .pcraft: manifest and convert carry both with serde defaults (older files
  load at 100 % and 0 px).
- PSD: export writes them as the vector density/feather mask parameters;
  import reads them into the shape (re-rendered, as the stored pixels lack the
  fill beyond the path). Soft unstroked solid/gradient shapes now import as
  shapes instead of fill layers with a vector mask; pattern-filled ones stay
  fill layers.

Photoshop's 10 px feather on a 100 px black square, row 100, x = 30..72:
ours is within 1 level of every measured value (8, 16 and 32 bits);
density 50 % shows 127/128 beyond the path and 0 inside.

Scorecard: TOOL-214-12 done.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-15 03:07:46 +02:00