94 Commits
Author SHA1 Message Date
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
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
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
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
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
Gabriel Heuser bcc0d37277 Fix Align Edges CI regressions 2026-11-09 22:11:43 +02:00
Gabriel Heuser d0fa260c79 Align shape fills and persist layer alignment in PSD 2026-11-09 21:07:15 +02:00
Gabriel Heuser b879ea9062 Match Align Edges tool behavior and separate PSD stroke adjustment 2026-11-09 20:06:45 +02:00
Gabriel Heuser 4e3fa96aff Fix Pixel Align Stroke follow-up review cases 2026-11-09 14:05:14 +02:00
Gabriel Heuser 6960d17119 Fix remaining pixel alignment review issues 2026-11-09 12:39:23 +02:00
superplay2021 31a6974050 Fix pixel-aligned stroke edge cases and add regression tests 2026-11-09 03:44:26 +02:00
superplay2021 87bc285ef7 Address remaining Pixel Align Stroke review feedback 2026-11-08 23:48:16 +02:00
qvest-ssels ff8d43669f Merge remote-tracking branch 'origin/main' into sweep/10405 2026-11-08 18:33:55 +01:00
superplay2021 22d0b1f94c Fix Pixel Align Stroke review findings 2026-11-07 02:57:25 +02:00
superplay2021 194d9d4fbb Implement opt-in pixel-aligned shape strokes
Align isolated integer-axis 1px stroke runs at render time while preserving
stored paths, dash lengths/offsets, and curve/diagonal antialiasing. Handle
filled live Line/ArrowLine geometry separately and retain rectangle corners
through reversed traversal and quarter-turn transforms.

Quantize eligible dash caps consistently, including fractional periods and
negative offsets. Round and square caps retain their extra pixel of extent.
Add model/native/PSD flag roundtrips, command validation and undo coverage,
selected-shape controls, custom-shape presets, and tool preset/reset support.
Document conservative fallback for unsupported widths, alignments and paths.

Validation: desktop build with two jobs in standard target; cargo fmt check;
cargo check --workspace; touched-crate clippy; 112 vector tests; command,
selected-shape/preset/reset, native roundtrip and PSD flag tests; adversarial
command panic hunt; layering checks. Manual 24MP vector render also passes.

Known validation limits: the broader workspace run is not completely green
(Windows junction permissions, automation cancellation, GPU timing, and
font-selection tests). Targeted font-input reruns resolve localization cases.
WASM std/core target is not installed. Full IO corpus and release perf checks
were attempted but not completed. No blanket Photoshop rendering-parity claim.
2026-11-06 23:38:03 +02:00