14 Commits
Author SHA1 Message Date
e6b7ac6df3 Fix-up for #11756: no Align Edges on the Star tool, as main's Polygon change says
Main's #13326 tests keep the Star tool without the checkbox (the reference
application has no Star tool; its stars are the Polygon tool's). Keep that,
and the comments and docs that name the Polygon drag.

Co-Authored-By: superplay2021 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 14:17:09 +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 1cce444e29 Merge latest main and reconcile shape alignment controls 2026-11-23 23:02:33 +02: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
Gabriel Heuser 470c0df57c Handle PSD grid move roundoff and clarify Align Edges docs 2026-11-09 23:27:32 +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
superplay2021 87bc285ef7 Address remaining Pixel Align Stroke review feedback 2026-11-08 23:48:16 +02:00
superplay2021 053be2fb4e Fix resumed Pen alignment and document-space stroke previews 2026-11-08 12:56:26 +02: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