`style.presets.new` with `includeBlending: false` and an explicit `opacity` stores only that
opacity, but `apply` with `add: true` skipped the blending block unless the preset had a blend
mode, so the layer kept its opacity. Test: an_opacity_only_style_added_sets_just_the_opacity
(also checks the layer's blend mode and Fill stay).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
layer_bounds goes back to the cached render's bounds, so the layer list,
copy and artboard paths don't re-render shapes. Align and Distribute use
align_bounds, which measures a shape's own extent off the canvas.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The .atn importer kept only bicubic, bilinear and nearest from a
transform's Intr, so a recorded Bicubic Automatic, Sharper or Smoother
Transform Selection replayed with the command's default (bilinear) and
re-exported without its choice. The bicubic variants are now kept (the
transforms already render them as Bicubic), Automatic becomes Bicubic
Automatic and Preserve Details Bicubic, and both transform commands list
the variants (#8697).
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
* fix(clipboard): render copied shapes in destination canvas space
When a copied shape group is placed beyond its source canvas, rebuild its vector caches against the destination canvas and pixel format. Previously a centered paste into a larger document could clip the caches to an empty source-sized frame, leaving no transform bounds and incorrect effects until a point edit refreshed each shape.
Restore missing shape caches and refresh source-clipped caches when canvas dimensions change. Cover Paste and Copy to Document, nested group contents, 8/16-bit destinations, rendered cache equality, transform bounds and movement Undo.
* fix(clipboard): measure shape placement before destination clipping
Restore missing source-space shape caches before measuring copy bounds, then adapt and translate for the destination. Re-render empty caches when shapes move back onto the canvas instead of shifting an empty raster.
Add focused integration coverage for 32 combinations of partial and full destination clipping, grouped shapes, missing caches, 8/16-bit output, centered and point placement, and Undo/Redo. Clippy and WASM checks pass.
---------
Co-authored-by: kotulsky <7805437+kotulsky@users.noreply.github.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
contained_panics_count_and_graceful_errors_do_not used the 4 s hang
budget meant for fuzzed commands. With RUST_BACKTRACE=1 the panic hook
prints a backtrace, and on loaded Windows runners the first symbol
lookup took long enough (19.6 s) that run_watched returned None instead
of Some(false). The self-test now waits up to 120 s; the fuzz keeps 4 s.
Photoshop records the composite entry of a Levels or Curves Set as
Chnl/Chnl/Cmps and silently leaves the adjustment unchanged when it is
Chnl/Ordn/Trgt, which is what the export wrote. Import already reads both.
Fixes#8543
* feat(guides): New Guide Layout takes lengths with units
view.newGuideLayout took pixels only. Its widths, gutters and margins now
also take text with a unit as typed in Photoshop's dialog ("1 cm",
"0.25in", "12 pt", "3pc", "10%"), at the document's resolution; percent
is of the target's width for columns, gutters and left/right margins and
of its height for rows and top/bottom margins, per artboard. The dialog's
Width and Height fields already pass such text through, so they accept
units now too.
Part of #4984
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(guides): New Guide Layout percent resolves per selected artboard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(guides): assert the full guide lists after a selected-artboard layout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(actions): a recorded Layers-panel drag keeps its drop target by name
Dragging a layer while recording stored layer.moveTo's target as a layer
id, which means nothing in the document the action later plays in, so
playback stopped with "no such layer". The target is now recorded by
name (with targetOccurrence among same-named layers), as layer.select
records its layer, and layer.moveTo accepts a target by name.
Fixes#7845
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(actions): count a drag's same-named targets without the moved layer
Steps are recorded after they run, so a target's occurrence among
same-named layers could shift when the moved layer shares its name. It
is now counted among the other layers only, at recording and at replay,
which the move doesn't reorder. Only a drag of the selected layer is
recorded by name; drags of several layers, or of an unselected one, keep
their ids.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(actions): a moved group's contents don't count as drop targets
Same-named layers inside a moved group also changed order with the
move, so they are left out of the occurrence count with the group.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(actions): leave every moved layer out of a named drop target
A move of several layers given a target by name no longer counts the
moved layers (or their contents) as candidates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(actions): a recorded ⌥-drag copy beside itself replays by name
A copy leaves its source in place, so the source stays a candidate for
the named target, at recording and at replay.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(actions): a recorded copy's own contents don't count as drop targets
The step is recorded after the copy exists; the copy (and, for a group,
its same-named contents) is left out of the occurrence count, as at
replay it doesn't exist yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(engine): refuse partial Color Balance and Hue/Saturation ATN exports
A `layer.setAdjustment` step changes only the settings it names, but the
Color Balance and Hue/Saturation descriptors written to the ATN carry
every setting and filled absent ones with defaults, so a partial edit
replayed as one that also reset the rest. Strict export now refuses such
a step (with skipUnsupported it is listed in Skipped); complete ones
export and round-trip as before.
Fixes#8531
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(engine): refuse Hue/Saturation ranges missing their own settings
A colour range written without its own hue, saturation and lightness
would replay with the missing ones reset to 0, so strict export refuses
it like a partial master setting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(engine): refuse wrong-shaped Color Balance and Hue/Saturation settings
Strict export now checks the triplets, numbers and flags it needs are of
the shape the descriptor writer reads, since it would write anything else
as 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(engine): refuse malformed Hue/Saturation range bounds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(engine): cover malformed and valid Hue/Saturation range bounds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(engine): refuse fractional Hue/Saturation range bounds
The descriptor stores them as integers, so a fractional bound would be
rounded on export.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(type): type.edit with new text keeps the styles of unchanged text
`type.edit {"text"}` replaced the whole string, so every character took
the first run's style and other styled ranges were lost. It now replaces
only the span that differs (after the common prefix and suffix), so the
unchanged text keeps its character and paragraph styles and an added
character takes the style beside it, as the params doc promised.
Fixes#8489
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(type): text inserted at a paragraph's start joins that paragraph
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Brings in 72 commits from main (bde13687). Two conflicts:
- apps/photocraft-web/Cargo.toml: main added the web-sys RequestMode feature;
the list is main's plus this branch's MediaQueryList.
- crates/ui-egui/src/prefs_ui.rs: main deleted the translation-coverage test
preference_labels_are_translated (c3aa3f9e, missing translations are now
reported by xtask ci); this branch had only adjusted it, so it goes.
docs/scorecard.md is regenerated; it differs from main only in UI-217-10.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A waiting stroke (Remove after each stroke off) was tinted with the brush it
was drawn with but removed with the brush at ↩, so changing the brush in
between made the tint and the removal disagree.
- `paint.remove`: a `strokes` entry may be `{"points", "size"?, "hardness"?,
"spacing"?}`, which override the call's for that stroke; a plain point
list still takes the call's.
- The UI keeps each waiting stroke as such an entry with the brush it was
drawn with; its tint (`stroke_brush` of it) and its removal both use it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Separable (an exact kernel, or box widths) is the blur Gaussian Blur
runs, taken from blur.rs's own functions; the CPU Gaussian is now built
from it, so a GPU operator running the same description can't drift.
OperatorRegion says which source pixels an output area reads, and
edge_extent is the edge-repeat extent the engine already used for layer
filters (now shared). Tests pin the reach to the CPU's real output and
check an output depends only on its input region.
Part of #5772 (Phase 1, step 1.1).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A recorded Camera Raw Filter value outside its slider's range (exposure
past +/-5, negative sharpening, ...) was imported and then clamped on
playback. It now leaves the step as a Photoshop step, using the PSD
mapping's ranges.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A recorded Camera Raw Filter step now stays a Photoshop step when a
value it records is not a number, when its curve splits are outside
0..=100 or out of order, or when a point curve is one that
filter.cameraRaw refuses (validate_curve), instead of replaying a
different look or failing on playback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Photoshop's Properties panel records an edit of an existing Vibrance
layer with the class string id `vibrance`, not the `Vbrn` code the
adjustment table knows, so the whole Set imported as an unsupported
Photoshop step and stopped playback. Map the string class to the same
adjustment.
Fixes#8534
The generated droplet shim only needs to run as its creator, so 0700 keeps
other local accounts from reading the CLI path it invokes. The reversed
range in the arrow-key test is the case under test, not an accident.
🤖 Generated with Codebuff
Co-authored-by: Codebuff <noreply@codebuff.com>
Review follow-up. In an Indexed document an off-table foreground paints as
its nearest table entry. Auto Erase still compared the stroke's start pixel
with the raw foreground, so a second stroke that started on what the first
one painted never switched to the background colour. Both the commit and
the live preview now compare against the foreground as the table paints it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up. The palette step quantised the whole stroke damage
rectangle as one dense buffer. A long diagonal stroke on a large canvas has
a rectangle near the size of the document, so this allocated about 28 bytes
per pixel of it. It also remapped pixels inside that rectangle the brush
never touched, which can already be off the table (Paint Bucket doesn't
snap yet).
keep_in_color_table now walks the rectangle tile by tile and maps only the
pixels that differ from the surface before the stroke (a cheap clone: tiles
are shared until written). The live preview compares against its own
pre-stroke surface the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An Indexed Color document keeps its pixels expanded to RGB with the palette
as side data, and the Brush rendered straight onto that surface. A red
stroke on a black/white document therefore left opaque red pixels, and soft
edges or partial opacity left blends, all outside the colour table, while the
document still reported Indexed mode. Photoshop (and GIMP, which documents
it) paint the nearest table colour instead.
The stroke commit now maps the damaged rectangle to the nearest table entry
with the same no-dither quantiser the Indexed Color conversion uses. That
keeps the table's transparent entry binary as well. The live preview
applies the same step, so the canvas shows the pixels the commit keeps.
This covers paint.stroke and paint.pencil, including erasing. Masks and
channels are gray targets and are left alone.
Fixes#8669
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
refine_mask_with builds its result densely over the selection's bounds
(grown by the spread, plus Refine Edge Brush additions). After a thin
edit across a huge canvas, or with a whole-canvas selection there, that
is billions of pixels. matting::refine_area names that area and
select.refineEdge refuses one over MAX_REFINE_AREA (2^30 px) with an
error before allocating, leaving the selection unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FszacAJDjznVimaxQktoJT
The Brush edit, the Lasso edit and EdgeBrush::new allocated a dense buffer
over their bounding box, which the swept-area cap does not bound: a 1 px
diagonal across a 100,000 px canvas sweeps ~141k px but asked for ~40 GB.
- matting::brush_surface (replaces brush_region) and EdgeBrush paint only
the tiles a stroke touches (painted_tiles), capped at MAX_PAINTED_TILES.
- selection::polygon_surface rasterises only the tiles the Lasso's edges
cross, byte-identical to selection::polygon; interior tiles share one.
- selection::combine_sparse adds/subtracts visiting only the new shape's
tiles, keeping the rest of the selection shared.
- select.refineEdge refuses edits and refineStrokes that would cross too
many tiles before painting anything, leaving the selection unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FszacAJDjznVimaxQktoJT
The tilt-shift reference tests and tiled_clear_and_fill_match_one_pass_over_the_area cross pixel
formats or channel counts with independent geometry and fill settings. Each run takes a quarter of
the combinations through Sweep, a different quarter each UTC day.
precheck_agrees_with_execute built all five document states for every call and kept one; it now
builds only the state the call needs.
main now has its own Recent Fonts (#3559), so this branch drops its separate
recent list (prefs `recentFontList`, `type.font.noteRecent`, `type.font.clearRecent`,
the five-font cap) and its font menu uses main's: the list is
`PhotocraftApp::note_recent_font`'s, the rows and arrow keys main's `font_menu_rows`,
and every applied family is recorded, as main does. Favourites, the class and
similar/variable filters, the style expander, format badges and the live preview
stay. Faux Bold keeps the one-pass thickened outline on main's fallible coverage
buffers (#6001), budgeted as a plain pass. Both sides' strings and icon credits are kept;
the scorecard is regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new fill or adjustment layer made while something is selected takes the
selection as its layer mask (#1250). In Photoshop the marching ants are then
gone, as after Reveal Selection, which drops the selection since #5251.
PhotoCraft kept it, so the next pixel edit on another layer (Duplicate,
Desaturate, Levels…) only touched the area inside the old selection.
mask_new_layer now clears the selection when it became the layer mask, in
the same history step: one undo removes the layer and brings the selection
back. A path used as vector mask leaves the selection alone, and so does the
Gradient tool's fill layer.
Tests: new_adjustment_and_fill_layers_are_masked_by_the_selection asserts the
selection is gone and comes back on undo, and the new
an_edit_after_a_new_fill_layer_on_a_selection_reaches_the_whole_layer covers
the duplicate-and-desaturate case (both fail on main). Tests that deselected
right after a new fill layer no longer need to; tests that need a selection
after one select again.
Action playback treats Deselect with nothing selected as a silent no-op
since #6744, as Photoshop does. photocraft-cli runs its --cmd list and
batch steps one by one through command_run, so a Deselect after Reveal
Selection (which drops the selection since #5251) stopped the whole run
with "no selection" and wrote no output.
run and batch now use the same check as playback (actions_cmds::noop_step,
now public). run still prints a result line for the skipped step. A single
Deselect outside a script stays disabled, as the #6744 test wants.
Tests: deselect_noop_tests::run_skips_deselect_with_nothing_selected and
batch_skips_deselect_with_nothing_selected (both fail on main).
Review of #8783:
- The Invert edit no longer builds a canvas-sized buffer: the canvas
takes the inverse of the selection's untouched value (one shared tile
for every fully covered tile, as fill_rect stores it), then only the
tiles the selection holds are inverted. Byte-for-byte equal to the
dense inversion; a 100k x 100k canvas inverts in well under a second.
- A run of Inverts is applied as one or none (pairs cancel exactly), so
4096 of them cost at most one pass between other edits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #8783:
- matting::brush `segments` no longer collects its pieces: they are made
as they are painted, and each segment is first cut to the painted area
grown by the brush. A 1 px stroke zigzagging across 2 million px
(within MAX_SWEPT_AREA) split into ~134 million pieces collected up
front (~2 GB) in brush_region and EdgeBrush::new; now ~5000 pieces.
- select.refineEdge `edits`: the Brush edits' swept area in all is
bounded by MAX_SWEPT_AREA, as refineStrokes' is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without a cached render, an inverted or sub-100 % density fill measured
as empty and dropped out of Align and Distribute.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Align and Distribute now measure through layer_bounds_in with the
document bounds as the frame for gradients that aren't aligned with the
layer, so an opacity stop measures as the cached render shows it; only
the render clip is widened to the shape's reach.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
select.refineEdge takes `edits`: the Select and Mask workspace's Quick
Selection, Brush, Lasso, Object Selection, Select Subject, Clear Selection
and Invert, applied in order to the starting selection (or layer mask)
before the edge is refined. Cancel discards them, OK is one history step,
and agents drive them over MCP and the control channel.
- engine/select_mask_edits.rs: parse (bounded, every bad field an Err)
and a pure apply/apply_one the workspace preview can share
- algo matting::brush_region: soft round brush coverage (hardness)
- ATN export reports steps with edits instead of dropping them
- "Edits" label in the 21 catalogs
Part of #7069 and #8148 (the workspace UI follows in a second PR).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shape is rendered over its feathered reach, not just its path and
stroke; a fill that shows everywhere (inverted path, or density below
100 %) keeps the canvas-clipped measure, having no extent of its own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Align and Distribute measured shape layers from their cached render,
which is clipped to the canvas, so a shape partly off the canvas looked
smaller and Align moved layers by the wrong amount, needing several
clicks. A shape layer is now measured from a render over its own path
and stroke bounds, unclipped (or by those bounds past 64 MP).
Fixes#8660
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>