Commit Graph
104 Commits
Author SHA1 Message Date
David MannandClaude Opus 5.5 993a0b7ee6 Batch fix-up: path sampling returns a piece's exact end points (CodeRabbit on #18551)
Far from the origin the blend of a piece's ends loses the near end's digits: a line from (1e16, 0) to (1, 0) sampled
at its length gave (0, 0). The start and the end are now returned as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 03:46:21 +01:00
David Mann a9e76540b6 Merge PR #18401: Fill: Place Along Path scripted pattern (#17430)
# Conflicts:
#	crates/compose/src/scripted_pattern.rs
#	crates/engine-paint/src/cmd/fill_cmds.rs
#	crates/engine-paint/src/fill_script_brick_tests.rs
#	crates/engine-paint/src/lib.rs
#	crates/ui-egui/src/dialogs/fill_script_ui.rs
#	crates/ui-egui/src/dialogs/fill_script_ui_tests.rs
2026-12-01 00:18:15 +01:00
David MannandClaude Opus 5.5 a5206743e0 Vector: a sampled corner takes the piece that ends there in any request order
Polyline::sample kept the cursor on the current piece when a request
landed exactly on that piece's start, so the same arc length gave the
next piece's direction after a later request and the previous piece's
on its own. Reset at that boundary too (review finding on #18401).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 23:18:58 +01:00
David MannandClaude Opus 5.5 7d75b77f71 Fill: Place Along Path scripted pattern (#17430)
Edit > Fill > Pattern > Script > Place Along Path lays the pattern tile
along the path selected in the Paths panel: tiles centred on the path,
the first on the start point, turned with the path, a step of the tile's
shorter side plus Spacing apart, placed while they end before the path
does, every other tile mirrored with Alternate patterns. The dialog has
the 10 controls with their check boxes and greying rules; without a
selected path the fill is refused with "No path selected" and the dialog
does not open. Path sampling by arc length lives in the vector crate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 23:03:00 +01:00
qvest-ssels f4fe8e0bc1 Merge main into fix/gradient-fill-overlay-source-13557
# Conflicts:
#	crates/engine-core/src/cmd/convert_gradient_tests.rs
#	crates/engine-core/src/cmd/gradient_fill_cmds/source.rs
2026-11-27 11:12:56 +01:00
superplay2021 ffe41a5dc5 fix(cmyk): discard invisible ink before dropping alpha 2026-11-25 03:51:55 +02:00
superplay2021 492cbae90b fix(cmyk): preserve native CMYK in vector shape fills and strokes 2026-11-25 03:13:59 +02:00
5d5f32665a Fix-up for #11756: name the bounds tuple for clippy
Co-Authored-By: superplay2021 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 13:12:10 +01:00
f2ac09d2ec Fix-up for #11756: Align Edges as the reference application renders it
The PR snapped shapes with a per-edge heuristic (pixel_align.rs, dash-cap tie
rules, a PSD coordinate-frame field threaded through engine, format and caches),
defaulted the option to off, and renamed the existing Rectangle/Triangle
"Align Edges" checkbox to "Snap Bounding Box" next to a second checkbox.

The reference application fits the whole shape at render time: the bounds of
what it paints (fill, or the stroke's outer edge) get a whole-pixel left/top
(a half rounds up) and a whole width/height, and the path is translated and
scaled into that box. Fill and stroke take one transform; curves stay
antialiased; inner edges of several subpaths are not snapped.

- photocraft_vector::align_edges implements that rule; CompiledShape applies it,
  so caches, the compositor, previews and extents agree; the fill/stroke split
  under layer effects starts from the whole shape's transform.
- Removed pixel_align.rs, the rasterizer helpers it needed, the document-space
  drag preview and psd_coordinate_frame (rounding the bounds absorbs the PSD
  quantization it was for).
- One Align Edges checkbox (ToolOptions::align_edges, stored and scripted as
  useAlignedRendering, older align_edges still read) on every shape tool and the
  Pen, on by default and after Reset Tool; it snaps the drag and sets the layer.
- PSD sn2P: written as 1 when on and left out when off, as the reference saves it.
- Dropped the dead path.set param, moved the control-protocol paragraph,
  rewrote docs/pixel-aligned-strokes.md, reverted the unrelated raw, font,
  Cargo and test-harness changes.
- Tests reproduce the measured cases (rectangles at .25/.4/.5/.6/.75, ellipse
  extremes and curve symmetry, 1/2/3 px strokes, rotated rect, Pen triangle,
  two subpaths, toggle off, stored path unchanged, one checkbox, Reset Tool).

Co-Authored-By: superplay2021 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 13:02:42 +01:00
qvest-ssels 89dc118be8 Merge remote-tracking branch 'origin/main' into merge-13855-tmp
# Conflicts:
#	crates/doc/src/effects.rs
2026-11-22 00:04:57 +01:00
superplay2021 e1ba70a49b Merge latest main and fix Align Edges test compilation 2026-11-21 22:31:23 +02:00
superplay2021 2100c0a724 Preserve PSD alignment data and fix dashed rectangle corners 2026-11-20 05:23:34 +02:00
superplay2021 31de878f08 Merge latest main and resolve Align Edges conflicts 2026-11-20 04:44:04 +02:00
David MannandClaude Opus 5.5 d488745e8a Merge main into fix/12709-alt-selects-subpath
The anchor tools' overlay moved to the shared UI framework, so the old ui-egui changes are dropped
in favour of main's structure; the engine and vector changes stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 18:55:06 +01:00
qvest-ssels a8c5d1b07a Merge remote-tracking branch 'origin/main' into fix/gradient-fill-overlay-source-13557
# Conflicts:
#	crates/io/src/blocks/tests.rs
#	crates/ui-egui/src/dialogs/layer_style.rs
#	crates/ui-egui/src/tools/gradient_ui.rs
#	crates/ui-egui/src/tools/gradient_ui/properties_panel.rs
2026-11-18 15:55:53 +01:00
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
qvest-ssels e3d8178baa Merge remote-tracking branch 'origin/main' into HEAD 2026-11-16 07:30:32 +01:00
David MannandClaude Opus 5.5 048277f619 Address CodeRabbit review: a duplicated joined subpath stands alone
path.moveAnchors with duplicate cloned the subpath with its stored
operation, so a copy of a joined subpath (a component's hole) became part
of whichever component was last. It now goes through
edit::duplicate_subpaths, which keeps the source's operation (as measured
for #13211) but gives a joined subpath's copy its component's stored
operation. The helper no longer forces Combine on a copy of the first
component, which contradicted the measured case. Direct Selection's drag
preview uses the same helper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-16 02:13:30 +01:00
David Mann 64118a0c5e Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	crates/engine/src/cmd/path_edit_cmds.rs
#	crates/ui-egui/src/tools/direct_select.rs
2026-11-15 16:11:59 +01:00
superplay2021 528fb9abb2 Fix aligned dash phase and clarify rendering limits 2026-11-14 15:35:30 +02:00
superplay2021 3db0c99fe5 Merge main and fix Align Edges integration 2026-11-14 14:08:31 +02: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
Gabriel Heuser 239a1c49c9 Merge branch 'main' into fix-pixel-aligned-shape-strokes 2026-11-13 23:31:44 +02: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
David MannandClaude Opus 5.5 1b2e48e63c Add Anchor Point: keep Alt from the press; a copy of the first component combines
Review fixes for #12709:
- The canvas captures the press modifiers for Add Anchor Point, so letting
  go of Alt before the drag is recognised still duplicates the subpath.
- duplicate_subpaths gives a copy the operation its component draws with;
  the first component always combines, so its copy no longer subtracts a
  hole from the original.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 21:03:57 +01:00
David MannandClaude Opus 5.5 14e41c50b2 Add Anchor Point: Alt selects or duplicates the whole subpath (#12709)
Alt no longer turns Add Anchor Point into Delete Anchor Point. Alt+click
on a segment of the targeted path selects that whole subpath with no
History step; Alt+drag copies the subpath and moves the copy, one step
"Drag Path", leaving the copy selected. Alt+click on an anchor deletes
nothing. The cursor with Alt held is the arrow with "+" everywhere.

path.moveAnchors gains "duplicate": the subpaths holding the anchors are
copied to the end of the path and the copies move (vector
edit::duplicate_subpaths, shared by the canvas preview).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 20:29:26 +01:00
qvest-ssels 66dc04d47b Merge remote-tracking branch 'origin/main' into fix/gradient-fill-overlay-source-13557 2026-11-13 18:29:06 +01:00
qvest-ssels 8f974de5fe Gradient Fill layers and Gradient Overlay keep Photoshop's gradient (#13557)
A PSD gradient fill (GdFl) or Gradient Overlay (GrFl) with Smoothness
above 0, a method other than Classic or Lab stops (an overlay also with
midpoints off the middle) keeps Photoshop's own gradient next to the
dense stops baked from it: colour stops, midpoints, Smoothness, method
and opacity stops, in the GradientInterpolation record the overlay
already had (now with midpoints and opacity stops) and in a new
Fill::Gradient `interpolation` field. The compositors still render the
baked stops.

The Properties gradient editor, the on-canvas widget and the Layer
Style page show and edit those stops; gradient.fill.set/stop edit them
and bake again (geometry edits leave the bake exact), and
gradient.fill.set takes `method` and `smoothness`. A preset replaces
the record. A PSD save writes the kept gradient (Intr, the method
enum) while the render stops still match it, so read, write, read
keeps it; .pcraft keeps it too and older files still load.
2026-11-13 16:49:22 +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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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
Gabriel Heuser d186d8cb16 Merge branch 'main' into fix-pixel-aligned-shape-strokes 2026-11-12 07:58:40 +02: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 <[email protected]>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium
2026-11-11 10:44:50 -05:00
superplay2021 20ca04c875 Merge main and preserve Pen reset options 2026-11-11 12:36:18 +02: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
Gabriel Heuser ebe542c630 Merge branch 'main' into fix-pixel-aligned-shape-strokes 2026-11-10 21:55:28 +02: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
Gabriel Heuser 345fe9c01c Use consistent half-pixel rounding across zero 2026-11-10 00:32:53 +02:00
Gabriel Heuser eadbc5467e Clarify Align Edges output and snapped-render regression test 2026-11-09 22:58:27 +02:00