Commit Graph
65 Commits
Author SHA1 Message Date
FredApps 33acd45399 Merge pull request #10458 from hectorviov/fix/small-mask-feather
Small mask feathers spread as Photoshop's do (#9476)
2026-11-18 16:22:13 +07:00
RickiNano e3e423d44a Delete Segment: refuse a Combine split whose halves overlap (#13606)
One component sums the halves' winding numbers; two Combine components are
filled each on its own and united, so a reversed half inside the other would
turn a hole into fill. Split a Combine subpath only when the halves' boxes,
handles included, are apart.
2026-11-13 23:13:17 +01:00
RickiNano 4030108d08 Delete Segment: refuse splits whose shape components aren't measured (#13606)
An open subpath split by path.deleteSegment gave the new half a copy of
its op, so an Intersect, Exclude or Subtract subpath folded in as two
components, a first subpath's stored op suddenly applied, and a Join
subpath after it moved to the other half's component. Until #13606
measures the reference, only splits where both readings agree go
ahead: a Combine subpath that is a component of its own, or a Join
subpath after the first. The rest return an error with no History
step; the Delete key shows it and keeps the layer.
2026-11-13 22:02:35 +01:00
RickiNano 0b4d7692c8 Merge remote-tracking branch 'origin/main' into fix/direct-select-delete-key-13203
# Conflicts:
#	crates/ui-egui/src/tools/direct_select.rs
2026-11-13 15:55:04 +01:00
Trevor BrownandClaude Sonnet 5.5 87ee062e41 Merge remote-tracking branch 'upstream/main' into fix/13350-triangle-fills-box
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium
2026-11-13 05:53:44 -05:00
RickiNano 675bd970f3 Line tool: fill the wedge a concave arrowhead leaves; whole-percent concavity (#13258)
With a base bent toward the tip, the shaft stopped where the bent base
crosses its edge and left the wedge up to the base's middle unfilled. The
shaft's end now follows the bent base to its middle, which fills the wedge
without reaching past the head's flanks, matching the reference outline.

shape.create / shape.edit round arrowConcavity to a whole percent, as the
gear and Properties fields do.
2026-11-13 06:11:29 +01:00
RickiNano a7990ee1f2 Line tool: arrowhead Concavity takes -50..50 % (#13258)
Concavity is a whole number from -50 % to 50 % of the head's length, as in
Photoshop. A negative value bends the head's base away from the tip, and the
shaft now ends where the bent base crosses the shaft's edge. Values outside
the range (documents, PSDs and settings saved with the old 0..100 range) are
clamped to the nearest end instead of failing.

- vector: arrow_line bends the base by concavity x length, both directions
- engine: shape.create / shape.edit take arrowConcavity in -50..=50
- io: PSD import keeps negative concavity, clamped to -50..50
- ui: gear and Properties Concavity are whole-number fields with the
  "Closest value inserted" alert; the gear menu stays open on clicks inside
  so a value can be typed
2026-11-13 06:11:29 +01:00
Trevor BrownandClaude Sonnet 5.5 cbd389a504 Triangle tool: tests for hostile and degenerate boxes and for the triangle_live field (#13350)
The hostile-radii test now tells the command guard's internal error from a graceful one, and a new test sends hostile boxes. The vector tests pin zero-size, sliver and tall thin boxes. The format tests cover both fields present, a field holding another kind, and junk in triangle_live.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium
2026-11-12 20:19:03 -05:00
Trevor BrownandClaude Sonnet 5.5 303be52228 Triangle tool: the triangle fills its box, as its own live kind (#13350)
A new live shape kind, LiveShape::Triangle { rect, corner_radius }, draws an isosceles triangle that fills the dragged box (apex at the top centre, then bottom right, bottom left). The engine no longer turns a triangle into an inscribed 3-sided polygon. Triangles saved before this are 3-sided polygons and keep that geometry.

The .pcraft manifest stores a live triangle in a new optional triangle_live field beside live (as arrow_live does), so older builds open the file and show the saved path. PSD export writes no vogk for a triangle, as for polygons.

Arms the new kind forces: live_kind, the axis-aligned transform, params, the corner radius widgets and the Properties Shape section (Corner radius only). Shift keeps today's equilateral triangle, sent as its tight box.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium
2026-11-12 19:27:36 -05:00
RickiNano 27c1589ee9 Merge remote-tracking branch 'origin/main' into fix/direct-select-delete-key-13203
# Conflicts:
#	crates/ui-egui/src/tools/direct_select.rs
2026-11-12 18:40:46 +01:00
RickiNano 4d1cc4b6e5 Freeform Pen: a failed short fit no longer stops the reach (#12838)
A few samples can fit worse than more, so a failed doubling step looks one
step further before it stops. On whole-pixel samples the vee now gets the
reference application's four anchors at Curve Fit 2 (was five); the Curve
Fit 2 tests run on both the given and the whole-pixel strokes.
2026-11-12 17:42:38 +01:00
RickiNano 16c8e5c4d1 Freeform Pen: anchors on the trace's turning points, rounded joins (#12838)
fit_trace places the Freeform Pen's anchors as the reference application
does on the issue's sample strokes: corners only at turns sharper than
80°, each run fitted one segment at a time as far as one cubic follows the
trace, ending on the first turning point in x or y within reach, with the
segment's turn bounded by Curve Fit (75° per px, at most 150°). The end
handle of each piece is fitted, not estimated. A closed trace keeps its
release point as an anchor. Make Work Path keeps its fitting.

Curve Fit 2: sine 6 anchors on the peaks, circle 5, open circle 4, vee 4
smooth, line unchanged; 0.5 and 1 px give more anchors.
2026-11-12 16:41:55 +01:00
David Mann 3e6d361735 Merge pull request #13215 from TrevorBrown-dev/fix/add-anchor-straight-smooth-12706
Add Anchor Point: an anchor added to a straight segment is smooth, with handles (#12706)
2026-11-12 02:19:45 +01:00
RickiNano cb5298e9d4 Polygon tool: a rounded star rounds only its outer points (#13308)
live_path rounds a star's outer points and leaves its inner points
sharp corners, as the reference application does: a 5-point star at
Star Ratio 50 % with corner radius 10 has 15 anchors instead of 20.
Plain polygons keep rounding every vertex.

The on-canvas corner radius widget shows knobs at the outer points only
and takes its largest radius from them, so it previews the same path
as shape.create.
2026-11-11 20:41:00 +01:00
RickiNano 18602e6a2e Direct Selection: Delete removes the selected anchor, segment or targeted path, not the layer (#13203)
With Direct Selection, Delete / Backspace fell through to Edit › Clear and
deleted the active layer. Now, as measured in the reference:

- one selected anchor goes with its two segments (path.deleteAnchor
  segments:true, as for the anchor tools, #12703): History "Delete Anchor Point";
- a selected segment goes on its own: the anchors stay, a closed subpath opens
  starting at the segment's end (new path.deleteSegment, History "Delete Anchor
  Point");
- with nothing selected, the targeted saved path or Work Path is deleted
  (path.delete, "Delete Path"), and a targeted vector mask goes as the Paths
  panel's trash deletes it.

Several selected anchors and a shape layer's path with nothing selected were
not measured and keep today's route.
2026-11-11 19:00:33 +01:00
Trevor BrownandClaude Sonnet 5.5 cbd96a4de6 Add Anchor Point: an anchor added to a straight segment is smooth, with handles (#12706)
add_anchor no longer special-cases a straight segment: it is split by de Casteljau at t with controls (start, start, end, end), like any cubic. The neighbours' handles stay retracted, the new knot is smooth with handles a quarter of the segment either side at the middle, and it stays at the cubic point at t. New tests in edit_add_anchor_straight_tests.rs; the two corner expectations in edit.rs and the Add tool's straight-segment test now expect the smooth point.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium
2026-11-11 10:44:50 -05:00
Tanish Manku 0b81067e4b Merge pull request #10405 from qvest-ssels/fix/pen-add-anchor-smooth-8653
Pen / Add Anchor Point: select the added smooth anchor and drag it (#8653)
2026-11-11 00:16:33 -07:00
RickiNano 4af62e8abb fix(ui): Delete on an anchor selected with Add Anchor Point removes it, not the layer (#12703) (#12796)
* fix(ui): Delete on an anchor selected with Add Anchor Point removes it, not the layer (#12703)

With the Add Anchor Point tool and one anchor selected (Ctrl+click), Delete
and Backspace fell through to Edit > Clear and deleted the active layer.
They now remove the anchor and its two segments, as in the reference
application: a closed subpath opens there. One history step, Delete Anchor
Point.

- vector: edit::delete_anchor_and_segments (a closed subpath opens at the
  anchor; an open one loses an end or splits at an inner anchor)
- engine: path.deleteAnchor takes "segments": bool (default false keeps
  joining the neighbours, as the tool's click does)
- ui: delete_key_deletes_anchor next to delete_key_deletes_work_path, and a
  Delete/Backspace branch before the work path's

* test(vector): Delete on one anchor of a closed two-anchor subpath leaves the other, open (#12703)

The kept anchor retains its handles and smooth flag, and the subpath keeps its path operation.
2026-11-10 20:08:21 +01:00
rmsff 0610e89921 Test deleting the last anchor of a saved path 2026-11-10 13:14:33 +03:00
rmsff 7a77b42a35 Delete Anchor Point: deleting a saved path's last anchor leaves it empty
A saved path whose only anchor is deleted keeps its place in the Paths panel with no subpaths, as in Photoshop. The Work Path, a shape's path, a vector mask and a Type Path still refuse it.
2026-11-10 13:14:33 +03:00
qvest-ssels ff8d43669f Merge remote-tracking branch 'origin/main' into sweep/10405 2026-11-08 18:33:55 +01:00
David MannandClaude Opus 5.5 16000b01ef Address CodeRabbit review: batch 17 findings
Engine: droplet dependency capture skips disabled steps; a nested Batch
that was cancelled or could not write its error log fails the caller;
runDroplet forwards overrideOpen; actions.rename follows named Batch
steps; Batch steps inside a script count against MAX_SCRIPT_STEPS;
output claims compare destination identity; Save and Close never
replaces a read-only source. ATN: Md must be a BlnM enumeration,
adjustment-layer names must round-trip, Calculations exports a missing
blending as Multiply, Apply Image refuses unnamed-layer transparency.
Filters: Shape Blur records its resolved geometry, reserves its kernel
memory first, and reports a preparation failure as an error, not a
cancel; Crop keeps an artboard preset when the size is unchanged and
fits the board on a turned crop.

Codecs/cms/algo: zero-axis FITS image HDUs are empty; a GIF walk that
breaks off before the trailer fails closed; two-value .3dl shaper rows
are applied; fragmented custom kernels are refused and their work polls
cancellation.

UI: Conditional branches play through panel playback; paused actions
refuse to resume after being replaced; Playback Options OK validates
its fields; transform double-click ignores a hidden pivot; path boxes
snap to a stationary selection; modal blocking uses the effective tool;
a picker-consumed release clears snap lines and ends a Move drag; the
Crop preset control shows Selection and checks only it; Crop box undo
restores frame_from_selection; Bosnian fill labels.

Tests: timing asserts moved to an ignored test, plus the review's
coverage nitpicks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 11:37:38 +01:00
yoriswind 0681361e6e Preserve Batch sources and cancellable action filters
Resolve recorded layer targets per Batch input and refuse destructive EXR Save and Close output. Prepare custom Shape Blur kernels in cancellable jobs, retaining Smart Filter progress and geometry. Preserve supported ATN descriptor metadata, defaults, channel sources and three-value LUT shapers; cover rebuilt naming rules, non-identity Custom kernels and float lookup dither.
2026-11-02 09:37:49 -08:00
Gabriel Heuser 24be8ea6e2 Add editable arrowheads to Line tool (#6408) (#9259)
* Add configurable arrowheads to line tool

* Add editable arrowheads to Line tool

* Fix arrow scaling validation and PSD import defaults

* Preserve arrow geometry under affine transforms

* Preserve scaled arrowhead dimensions and prevent non-finite geometry

* Localize arrowhead Start and End labels

* Fix arrow transform editability and short line handling

* Fix PSD arrow concavity serialization

* Fix arrow dimension fallback validation

* Refine arrowhead options UI to match Photoshop

* Add opt-in arrowhead defaults to Shape properties

* Fix tool reset syntax after upstream merge

* Validate arrowhead flags and clamp copied defaults

* Preserve editable headless lines under transforms

* Fix arrowhead UI imports and formatting after v0.17 merge

* Format arrowhead properties after v0.18 merge

* Fix Clippy lint errors in arrow geometry and tests

* Fix headless arrow geometry after nonuniform scaling

* Fix proportional arrow scaling in Properties panel

* Fix Rust formatting in Properties arrow scaling tests

* test: validate invalid arrowhead dimensions without mutation

* fix: preserve arrow compatibility with older pcraft versions
2026-11-01 18:46:05 -05:00
Hector VillarrealandClaude Opus 5.5 774cc4a6b4 Tests: feather_sigma at 0.5, 3 and 6 px (FredApps review)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:54:25 -06:00
Hector VillarrealandClaude Opus 5.5 de014e1fd0 Small mask feathers spread as Photoshop's do (#9476)
A 1 px Properties › Feather was up to 8 levels narrower than Photoshop's on a binary
mask. Photoshop's small feathers spread wider than sigma = feather: the feather sigma
is now sqrt(r² + min(r, 1) / 6), which keeps 1–10 px within 2–3 levels of measured
Photoshop edges, and tiny feathers still barely blur.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 02:01:43 -06:00
qvest-sselsandClaude Opus 5.5 5cd120579f Pen / Add Anchor Point: select the added smooth anchor and drag it (#8653)
Adding an anchor to a curve already split it exactly (de Casteljau) into a
smooth knot, but the new anchor was left unselected, so its direction handles
never showed and it looked like a plain point; a drag from the click did
nothing. As in Photoshop, the added anchor is now selected with its handles
showing (Add Anchor Point tool, the Pen's Auto Add on a document path and on
the path being drawn), and a drag from the click moves it, the add and the
move being one history step. Drawing on deselects it.

Tests: vector split exactness, collinear handles and shortened neighbour
handles on S-curves, half-retracted and closed wrapping segments; UI tests for
the selection, the drag, one-step undo and the Pen draft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 00:42:42 +01:00
FredApps c93c0bb36d Merge main into trimmed integration; reconcile blur, pattern and Liquify behavior 2026-10-29 23:47:53 +01:00
FredApps 255ecc81d0 Remove 21 requested PR contributions from the 108-PR integration
Retain 87 PRs. Reconcile overlapping integration fixes and update testing scope.
Removed: #7153 #7742 #5493 #9282 #3455 #9172 #3139 #3967 #4783 #5453 #8347 #1991 #3345 #4042 #4305 #4883 #4890 #5090 #6621 #5870 #5939.

Combined CI pending for this source; historical portable artifact is not applicable.
2026-10-29 18:49:17 +01:00
FredApps 4f23f459ba Merge approved PhotoCraft PR #3464: fix(vector): target selected saved paths and own Pen gestures
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Reconcile captured Pen and Freeform targets with current resumed-subpath, Type Path, Path Operation and draft recovery behavior. Valid source-owned tab switches commit to captured original target; invalid snapshots cancel with a diagnostic; refused commits retain draft and suppress automatic retries. Preserve current Saved(index) API and hidden-work-path protections, register all new ownership/gesture tests and add original-target tab-switch/deleted-target cases. Includes verified compile/API corrections from prior checkpoints.
2026-10-29 06:33:02 +01:00
FredApps 8323688e1f Merge approved PhotoCraft PR #5453: Shapes: independent fill and stroke paints (solid, gradient, pattern), part 1
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Integrated independent exact shape paints and atomic pattern clipboard snapshots into current modules, preserving current soft-mask coverage, shape cache keys and gradient stop caps. Shared bounded COW pattern sampling now retains minification filtering; shapes/clipboards resolve lazy catalog entries to full pixels. Preserved CPU/GPU/depth/model regression matrices; also corrected missing glow-test enum imports found by the 80-head check.
2026-10-29 05:53:29 +01:00
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
2026-10-25 10:36:43 -06:00
Finn Newick e43f7dbacc Merge remote-tracking branch 'origin/main' into fix/align-shape-bounds 2026-10-23 23:07:52 +01:00
Dylan M. Taylor 78ae50f7b2 security: bisect flat-table and gradient-stop lookups; charge ICC curve samples; bound PSD planes, RAW ljpeg retention and TIFF dump preview 2026-10-23 14:41:53 -04:00
Dylan M. TaylorandCodebuff f346b5c8f4 fix(vector): bound hostile geometry and raster work (#8769)
* fix(vector): bound hostile geometry raster work

Guard geometry and tracing operations against malformed dimensions and degenerate inputs with bounded work and safe failures.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>

* fix(vector): address review (knot cap on split, relative identity tol, non-vacuous test)

* revert(geom): splitting past the quilt limit is intentional (smart_map test)

* fix(geom): cap identity tolerance at 1e-6 px

---------

Co-authored-by: Codebuff <noreply@codebuff.com>
2026-10-23 09:56:08 -04:00
Finn NewickandClaude Opus 5.5 ad91e9f387 fix(align): feather a measured shape over its reach, gradients in the canvas
CompiledShape::new used one rectangle as both the gradient frame and the
area a feather is computed over, so measuring in the document's frame cut
the feather off at the canvas. CompiledShape::with_frames takes the two
separately; Align measures with the feather over the shape's reach and
gradients in the canvas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 06:17:56 +01:00
bazmarth 4573037531 Merge remote-tracking branch 'origin/main' into feat/polygon-corner-radius
# Conflicts:
#	docs/scorecard.md
#	docs/ui-parity.md
#	scorecard/tools.toml
2026-10-21 16:49:42 +00:00
bazmarth 7978cbc1ee Merge remote-tracking branch 'origin/main' into feat/polygon-corner-radius
# Conflicts:
#	docs/ui-parity.md
2026-10-15 13:17:31 +00:00
Skyfuller1303 e22a9baedc fix: preserve tiny pattern scales and account for cached tiles 2026-10-15 11:47:12 +02: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) <noreply@anthropic.com>
2026-10-15 03:07:46 +02:00
bazmarthandClaude Opus 5.5 8744820a27 Shapes: rounded corners on live triangles, polygons and stars (TOOL-214-12)
As Photoshop's rounded triangles and polygons, a live polygon (the Triangle
tool draws a 3-sided one, stars included) now has one corner radius:
- doc: LiveShape::Polygon gains corner_radius (serde default, so older
  .pcraft files load sharp);
- vector: shapes::fillet and shapes::round_corners round every vertex with a
  circular arc tangent to both edges, each capped so neighbouring arcs meet
  at most halfway along an edge;
- engine: shape.create / shape.edit take "cornerRadius"; transforms scale it
  like a rectangle's radii;
- ui: the Properties panel shows a Corner radius field for polygons, and the
  on-canvas corner widgets now cover every selected rectangle, triangle,
  polygon and star (Path Selection, the Rectangle/Triangle/Polygon tools,
  Move with Show Transform Controls). Dragging any widget gives every
  selected shape the same radius; Alt still changes one corner of a
  rectangle. The widgets take the unsnapped press: snapping used to pull a
  shape tool's press off the widget, so the tool drew a new shape instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 22:07:03 +00:00
Valentin KleinandClaude Opus 5.5 bcaadccbfa Vector: bound flattening memory, keep over-budget dashes, cheaper edge build (#5195) (#5204)
* Vector: bound flattening memory, keep over-budget dashes, cheaper edge build (#5195)

- flatten: a path's flattened points are capped at 1 << 20; past it every
  curve keeps a proportional share of its pieces (at least one), so hostile
  handles from files (vmsk, SVG, effect outlines) cannot exhaust memory.
  fill_rasterizer flattens the whole path under one budget.
- stroke: past the dash step budget (or below coordinate precision),
  dash_polyline keeps the dashes made so far and draws the rest solid
  instead of dropping the stroke. Open polylines are no longer copied.
- raster: coordinates are clamped to +-1e15 and edges with a non-finite
  slope (vanishingly short) are skipped, so huge finite coordinates no
  longer produce NaN coverage. fill_rasterizer sorts edges once instead of
  after every component (stable sort, identical order).
- Cleanups: dead miter `half`, dead loop-length check in trace_mask,
  shared mask render body, map_knots helper, shared straight-segment test.

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

* Vector: bound stroke outline points (#5211)

- stroke_polygons dashes all lines first, then counts round caps and
  joins. When their full-resolution tessellation would exceed 1 << 20
  outline points, every round cap and join gets the same smaller segment
  count (down to 4 per circle, 1 per join; area-exact radius kept).
  Strokes under the budget are unchanged; no piece is dropped.
- The dash step budget (100000) is now shared by all lines of a stroke
  instead of per polyline, so many subpaths cannot multiply the dash
  (and cap) count. Past it the rest is drawn solid, as before.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:02:09 -07:00
21c7cf637a Curvature Pen: edit finished paths (drag, add, smooth/corner) with an adaptive cursor (#5197)
* Curvature Pen: drag an anchor of the active path without a modifier

As in Photoshop, the Curvature Pen with no path being drawn shows the active
path's anchors (work path, active shape layer or targeted vector mask), and a
press-drag on one moves it with no Ctrl/Cmd. The curve reflows: every smooth
knot of that subpath gets its handles recomputed with the Curvature Pen's own
curvature_knots, so it keeps flowing through all its anchors; corners keep
their handles. The drag previews live and commits one history step.

- vector: edit::move_anchors_curvature
- engine: path.moveAnchors takes "curvature": bool=false
- ui-egui: direct_select routes the idle Curvature Pen press (Edit::Curvature)

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

* Curvature Pen: add anchors, toggle smooth/corner and adapt the cursor on finished paths

As in Photoshop, with no path being drawn the Curvature Pen also:
- adds an anchor where a segment of the active path is clicked
  (path.addAnchor), and a drag pulls it like any anchor; adding and dragging
  are one history step;
- toggles an anchor between smooth and corner on a double-click
  (path.convertPoint with the new "curvature" param, vector
  edit::toggle_curvature_point): a Pen-drawn corner rounds off and the
  segments around it curve through it; a second double-click makes it a
  corner again;
- shows what a press does in its cursor: + over a segment, four arrows over
  an anchor (also an anchor of the path being drawn).

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

* rustfmt

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-14 15:13:46 -04:00
Skyfuller1303 1eecd00b2d fix(vector): target selected saved paths and own Pen gestures
Path Selection, Free Transform Path, Direct Selection, Convert Point,
Add/Delete Anchor Point and the Pen's Auto Add/Delete now edit the work
or saved path selected in the Paths panel before the targeted vector
mask or active shape layer. Pen, Curvature Pen and Freeform Pen capture
their destination at the first anchor, keeping #4730's append to the
selected path.

Pen drafts, Direct Selection anchors and drags, Path Selection drags and
Freeform traces record document, revision and target; stale gestures
are cancelled and their late events consumed. Failed commits keep the
draft without retrying. path.set validates an appended path's complete
geometry before recording the edit.
2026-10-13 21:42:39 +02:00
Skyfuller1303 3ab072088c feat(vector): pattern paints for shape fill and stroke
Pattern fills on shape layers rendered transparent because the vector
renderer had no access to the document's pattern table. Add
Paint::Pattern, Paint::from_fill_with_patterns,
CompiledShape::with_patterns and render_shape_with_patterns, which
resolve a pattern by id or name and sample it in the document's colour
mode, for the fill and the stroke independently.

The compositor's fill/stroke split (used for clipped layers and interior
effects) now renders with the same patterns and colour mode on CPU and
GPU, and its cache key covers the referenced pattern tiles.

Refs #2496
2026-10-13 19:53:02 +02:00
Skyfuller1303 102f821461 refactor(vector): move pattern tiles from compose
Shape layers need to sample pattern tiles while rendering their fill and
stroke, and photocraft-vector sits below photocraft-compose. Move Tile,
Placement and pattern_rgba into photocraft_vector::pattern and re-export
them from compose so existing callers keep working.

The moved tile also guards against hostile input: non-finite sample
coordinates return transparent, wrapping no longer overflows on huge
coordinates, and a tile above 64 MiB of prepared pixels samples its COW
surface instead of allocating a second full buffer.

Refs #2496
2026-10-13 19:53:01 +02:00
David MannandClaude Opus 5.5 72c8f58e11 Shapes: a rectangle with a negative size extends from its origin like the other shapes (#4203) (#4204)
rounded_rect took the absolute width/height without moving the origin, so
shape.create {"kind":"rect","rect":[50,10,-20,30]} covered x 50..70 while an
ellipse or polygon with the same rect covered 30..50. Normalise (x, w) and
(y, h) for negative sizes instead. The Shape tool drag already normalises its
rect, so interactive drawing is unchanged.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 21:17:38 -04:00
6037ade5ed Fix straight-path anchor insertion at the hit position (#3856)
Co-authored-by: jonathnwxh <258340642+jonathanwxh-cell@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
2026-10-12 08:32:15 -04:00