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>
#4035's only code change makes Rasterize Layer Style separate its RGB bake
through the document's own CMYK profile, but none of its tests ran that
command (they cover Flatten, Stamp and Merge, which already worked), so
removing the change left every test green.
New test: a tagged CMYK document's layer gets a drop shadow that falls off
the canvas and is rasterized; the inks must come back within the profile's
round trip. Without #4035's change they move by 35 levels (0.137) and the
test fails; with it they pass at 8 and 16 bits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A NaN or infinite sample (32-bit documents can hold them) reached the
region means unchanged, so a region's colour, the edge offsets built from
it and the fill could turn non-finite or leave pixels uncovered. trace now
replaces non-finite channels with 0 before banding (copying the image only
when one is present).
Test: NaN and ±inf samples give finite region colours, outlines and pixels
with full coverage; it fails without the fix. (CodeRabbit review on #10328.)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts #5165 (merge d9b7c5f7cd). #5165 made a click on a section's name
in Brush Settings (Shape Dynamics, Scattering, …) show its controls
without ticking its box. In the reference application, checked by hand,
clicking the name shows the section's controls and ticks it; clicking the
name of a ticked section leaves it ticked. Only the checkbox turns a
section off. That is what PhotoCraft did before #5165.
brush_panel tests pass (50).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reference application's Liquify has Twirl Clockwise only; holding
Alt (Option on macOS) while using it twirls counterclockwise. PhotoCraft
had an extra Twirl Counterclockwise tool on the strip, and #9598 had just
given it a mirrored icon.
Twirl Counterclockwise leaves the tool strip (LiquifyTool::ALL, 11 to
10 tools) and the rotate-ccw icon #9598 added goes with it (asset,
icon_data entry, ATTRIBUTION count back to 113). Alt already reversed
Twirl Clockwise at stroke-down; that stays. The TwirlCcw variant stays as
a stroke's direction: Alt-strokes record `twirlCcw`, and filter.liquify
strokes and older saved strokes naming it still replay as Twirl
Clockwise reversed (the command doc says so). Selecting it as the tool
(control channel `tool: "twirlCcw"`, or a preference saved by an older
version) is refused with an error that says to choose twirlCw and hold
Alt; the rest of the settings still apply and the dialog opens.
Tests: the_tool_strip_has_no_twirl_counterclockwise (no such tool, label
or missing icon on the strip, C is Twirl Clockwise, `twirlCcw` as the
tool is an Err and leaves the tool, an old saved preference naming it
opens); alt_with_twirl_clockwise_twirls_counterclockwise (the field
displacement a dab leaves right of the centre points up without Alt and
down, mirrored, with Alt). twirl_counterclockwise_has_its_own_mirrored_icon
and the twirlCcw row of alt_reverses_twirl_and_swaps_pucker_and_bloat
are removed. The i18n labels for Twirl Counterclockwise stay (the
variant's label).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts #8039 ("Compose: Extend Softer outer glows past Size (#7899)"),
which added a range-scaled fading tail beyond Size to Softer outer glows,
on the CPU compositor and the GPU one alike, and widened the effect
margin by it.
The reference application, measured: Outer Glow, Softer, Size 60,
Range 50 % (and 100 % alike), white, Normal, Opacity 100 %, Spread 0,
Noise 0, on an opaque white shape over black (240 x 40 document, shape
over the left 100 px, full height, sampled at row 20): the glow reads 4
at 50 px from the edge, 1 at 54, and 0 from 56 to 70 px. It reaches zero
just before Size; there is no tail beyond it.
The reverted code (the two-box tent) gives, in that setup, 8-bit levels
4, 1, 0, 0, 0 at 50/54/56/60/70 px for Range 50 % (unrounded 3.56,
1.20, 0.49, 0, 0) and 2, 1, 0, 0, 0 for Range 100 % (1.78, 0.60, 0.25,
0, 0); #8039's tail lifted 56-62 px above zero. So the revert stays as
is, CPU and GPU unchanged from before #8039.
Conflicts were formatting-only (later rustfmt of #8039's lines) in
compose effects.rs, effects/paint.rs and gpu fx/builders.rs; resolved to
the pre-#8039 code. The GlowSource/GlowTechnique imports a later commit
kept in gpu fx/tests.rs for #8039's test go with the test.
New test softer_outer_glow_fades_out_before_its_size renders that
document through the CPU compositor at Range 50 % and 100 % and checks
50 and 54 px within 2 levels and 56, 60 and 70 px at exactly 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts #9703 ("Fix adjustment layer name clicks targeting masks"), which
made a click on an adjustment layer's name target the layer's contents
instead of its mask.
The reference application, measured through scripting (targetChannels):
selecting an adjustment layer from another layer targets its mask, as
before #9703; a masked pixel layer targets its contents; clicking the
content thumbnail still targets the contents. So the behaviour before
#9703 was right.
The revert applied cleanly. Its test asserting the opposite goes with it;
a_new_adjustment_or_fill_layer_shows_its_settings_until_the_mask_thumbnail_is_clicked
again expects a row click on a new adjustment layer to target the mask.
New test selecting_an_adjustment_layer_from_another_layer_targets_its_mask:
for Hue/Saturation and Curves layers, a name click coming from another
layer targets the mask (and painting goes to the mask), the content
thumbnail targets the contents, and a masked pixel layer's name click
targets its contents.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#8191, #8192, #8193 and #7903 made Cutout trace the image with its own
pipeline: an Oklab bilateral smooth, a median-cut/k-means palette,
lightness stretched towards black and white, colour that drifts inside a
shape, and Catmull-Rom curves. The result looks good but not like the
reference application. Measured there on a portrait, grey ramps, a hue
sweep and squares of known size:
- Tone bands are the plain mean of R, G and B in Number of Levels equal
steps (4 levels on a 0-255 ramp: steps at 64, 128 and 192). Colours of
different hue but the same mean share a band, so a saturated blue
headscarf and the grey around it come out as one averaged colour.
- Each connected region is filled flat with the mean colour of its own
pixels (ramp bands read 96, 160, 224 = their means). No stretch, no
drift: about 1,100 distinct colours on the portrait, edges included,
against 13,000 before.
- Edge Simplicity removes regions by size alone, the same on a 256 px
and a 600 px canvas: 6 px squares survive at 0-2 and 4 px go; 12 px
survive at 4; 48 px at 6; 96 px at 7; none at 8. Merged pixels count
towards the neighbour's mean.
- Outlines are straight-sided polygons that coarsen with Simplicity.
- Edge Fidelity nudges outlines only: 1.9% of the portrait's pixels
change from 1 to 2, 1.2% from 2 to 3 (PhotoCraft now 2.7% / 1.1%).
So the palette stage becomes the channel-mean band, regions keep their
flat mean colour, outlines stay straight (the Douglas-Peucker vertices,
no curves), and the minimum area follows the measured table. The
smoothing, palette, paper-colour and curve code that no longer runs is
removed, and quantize's median_cut/kmeans are private again.
Against the reference renders (mean absolute difference per channel,
0-255): the portrait at the defaults 4/4/2 went from 27.7 to 3.1, at
8/4/2 from 23.3 to 3.4; grey ramps from 17-47 to 1.7-3.4; the hue sweep
from 39.7 to 2.2; the noisy two-colour image from 57.5 to 1.2. Over 36
cases the summed error went from 676 to 229. The rest is mostly at Edge
Simplicity 7-10, where the reference keeps some mid-sized strips that
are merged here.
Tests: the ramp's band steps and tones; which square sizes survive at
Simplicity 0, 2, 4 and 10; every slider changes a radial gradient; the
region merge picks the neighbour with the longest shared border and
uses the measured area; Edge Fidelity changes 0.2-6% of the pixels;
islands keep their tone at low fidelity; tiling and seam tests as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#4985 added a canvas Shift+right-click popup that worked only for the
Brush and listed only its painting modes. In the reference application
Shift+right-click opens a menu for every painting tool: Edit Brush…
(the Brush Preset picker a plain right-click opens), a separator, then
the tool's own Mode list from its options bar:
- Brush, Pencil: the painting modes with Behind and Clear
- Clone Stamp, Pattern Stamp, History Brush: the blend modes
- Mixer Brush, Color Replacement, Background Eraser: Edit Brush… only
- Eraser: Brush / Pencil / Block (no Edit Brush…)
- Blur, Sharpen, Smudge: Edit Brush… (the reference lists modes too)
- Dodge, Burn: Shadows / Midtones / Highlights; Sponge: Desaturate /
Saturate
- Healing Brush: its blend modes; Gradient: the blend modes; Paint
Bucket: the blend modes with Clear (no Edit Brush…)
- Spot Healing, Magic Eraser and non-painting tools: no menu, the
gesture keeps its old route
brush_mode_menu.rs is now a per-tool item list (Item enum + items(tool))
instead of a Brush-only list. Each row sets exactly what the tool's
options-bar control sets: a brush-based tool's mode through
tools.setBrush (Brush/Pencil also Behind and their own Clear flag), the
Eraser mode, tone range, sponge mode, gradient and bucket modes as tool
options. Blend modes are grouped with separators; the current choice is
checked; Behind and Clear are greyed on the Background layer. The menu
remembers the tool that opened it and closes on a tool change.
Only settings the options bar already has are offered. Not offered yet
(no setting here): Behind for the stamps, History Brush, Gradient and
Paint Bucket; the Blur/Sharpen/Smudge modes; the Spot Healing modes;
the Healing Brush's Sampled/Pattern source and Replace; the History
Brush source.
Control: ui.inspect's brushModeMenu reports tool, mode, choices (the
active tool's labels) and items (label/enabled/checked, separators);
ui.context.choose {id: <label>} picks a row, an unknown or greyed row
is an error that changes nothing.
Tests (kittest): each representative tool's rows in order, choosing a
row sets the options-bar state and journal, Edit Brush… opens the
picker at the click, Behind/Clear greyed on the Background, Magic
Eraser and Spot Healing open nothing; control graceful failure for bad
choices. "Edit Brush…" added to every catalog.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#9594 fixed type copied between documents of different resolutions
re-laying out at the wrong size on its next edit by running the Image
Size resolution step on the copies: the type kept its point size
(24 pt) and got a compensating transform of src/dst ppi, with box and
path text scaled up to match.
The reference application, measured by script, keeps the pixels and
rewrites the point size instead: 24 pt copied from a 72 ppi document
into a 300 ppi one becomes 5.76 pt (24 x 72/300), and 24 pt from
300 ppi into 72 ppi becomes 100 pt. There is no transform, the
Character panel shows the rewritten size, and later edits keep it.
adapt_copies, which both Copy Layers to Document (Duplicate Layer to
another document, dragging layers between documents) and Paste of a
copied layer go through, now calls canvas_geom::retarget_type_resolution:
every size in points is multiplied by src/dst ppi (font size, leading,
baseline shift, first-line/start/end indents, space before/after) and
the PSD TySh is rebuilt. Box, path and transform are in pixels and stay
as they were; tracking, kerning and auto leading are relative to the
size and stay too. A resolution that isn't a positive number counts as
72 ppi (what the text engine lays it out at), and the scaled sizes stay
finite and above zero. Image Size keeps its own behaviour.
Tests: copy and Paste in Place, 72->300 (5.76 pt) and 300->72 (100 pt):
leading, baseline shift and indent scale, tracking stays, no transform,
the same ink bounds as the source, and after an edit the size is kept
and bounds and coverage match the source's render. Paragraph text keeps
its box and wrapping. Bad and absurd resolutions don't panic or produce
non-finite sizes. The #9594 test is replaced by these.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#6236 made Escape put back the colour the gesture started from. In the
reference application Escape while the right button is held closes the
HUD and keeps the colour picked so far; moving the pointer afterwards
changes nothing (measured: picked 0,40,96 from 40,90,160; after Esc and
a further move it stayed 0,40,96, also after the release).
Escape now ends the gesture like the button release does. The pick is
still one coalesced history step, so Undo takes it back.
Test: Escape closes the HUD with the picked colour kept, a later move
picks nothing, and releasing the button afterwards opens nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#6236 drew the hue strip left of the saturation/value square and opened
the HUD just below the press point. In the reference application the
square is on the left with the hue strip to its right, and the HUD opens
so the colour you start from sits under the pointer: pressing without
moving changes nothing, and a small move nudges the colour from there.
The HUD now uses that layout and placement (still pulled in to stay on
screen near an edge). The rects come from one `layout` function, shared
by drawing, hit-testing and the tests.
Tests: the square is left of the strip and the starting colour's spot is
under the pointer; a mid colour opens with the pointer inside the square
and picks nothing until it moves; near the bottom-right corner the HUD
stays on screen and the press alone picks nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#5176 made ±100% move the edge by max(radius, feather, 2σ smooth), at
least 1 px. Measured in the reference application (a 100 px square,
Radius/Feather/Smooth each varied, Shift Edge -100/-50/+100):
- A hard selection does not move at all, at any Shift Edge.
- On a feathered edge the result is a fixed per-pixel curve, the same at
2, 5 and 10 px feather: the pixel's odds a/(1-a) are multiplied by
49^(shift/100). At -100% a 50% pixel becomes 2%, at -50% 1/8, at
+100% 98%. The fit holds within ±0.05 in log-odds on every sample.
So Shift Edge is now that curve, applied last as before. It needs no
neighbours, so the morphology callback and the halo/spread it added are
gone, with the ignored benchmark that timed it (matting::morph itself
stays for Select › Modify and the mask view).
Tests: a hard edge is unchanged at ±50/±100%; seven measured
before→after coverage pairs; a feathered edge is pulled in; the engine
refine tests now check the hard edge stays and a feathered one moves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UPDATE_APP (native builds; craft-update is a native-only dependency) carries our 128 px icon and accent (#2f7bf5, its colour in ArtCraft Launcher). The updater, the self-update
helper and craft-update's startup prompt all get them through crate::UPDATE_APP; the
prompt draws the icon, the accent and "by ArtCraft" (craft-update's default developer).
craft-update is pinned to storytold/craft-libs main at 1065653e7 (#434).
Clippy fixes for Rust 1.99 in untouched code (same logic):
- apps/photocraft/src/app_dirs.rs
- crates/codecs/src/codecs/via_image.rs
- crates/engine/src/canvas_geom/tests.rs
- crates/ui-egui/src/panels/blend_preview.rs
AGENTS.md (and CLAUDE.md where present) gets a CI workflows section: workflows only call
craft-common-actions at @main, with no other jobs; feature and fix PRs don't touch CI and
link or open a craft-common-actions issue (a PR only for a small fix that is safe for
every app and does not increase CI time); legacy jobs
aren't added to and move only as their own task, staying until a shared workflow runs them.
windows-arm64.yml moves from its SHA pin to @main. The pinned revision is on
craft-common-actions main and the workflow (and the actions it calls) is identical
there, so nothing changes in behaviour.
* packaging: Flatpak finds and prints to CUPS printers
The Print dialog listed no printers in the Flatpak: the runtime has libcups but not
lpstat/lp, the sandbox couldn't reach the CUPS socket, and driverless network printers
(lpstat -e) need Avahi. Bundle lpstat/lp/lpoptions from CUPS 2.4.20 (Apache-2.0,
statically linked, licence installed) and grant --socket=cups and
--system-talk-name=org.freedesktop.Avahi in both manifests.
* print: lp takes the job only when CUPS lists a printer; the only printer by default; ~/.cups read-only
Review (CodeRabbit) on bundling lp in the Flatpak:
- With lp present but CUPS down or empty, the job failed on lp instead of reaching the
IPP route and the print portal. lp_route now gives up the route when lpstat lists no
printer, before anything is submitted.
- With no printer named, no default and one queue, IPP picked it but lp failed. lp_route
names the only printer.
- The sandbox ignored the user's default printer, saved options and client.conf server:
grant ~/.cups read-only in both manifests.
* print: no printers for lp means the portal, not IPP; bounded listing; CUPS socket wrapper
Review:
- When lp is there but CUPS lists no printer, the job went to the IPP route, whose
server detection ignores ~/.cups/client.conf and could print to a local default
printer instead of the configured server. It now goes to the print portal, or fails
with no portal.
- The lpstat listing before a job is bounded (10 s, then lp takes the job as before)
and runs outside SPOOLER, which guards only Windows driver calls.
- Flatpak mounts the host's CUPS socket at /var/run/cups/cups.sock whatever path
client.conf or CUPS_SERVER names; the CUPS tools now run through a wrapper that
points a socket path missing in the sandbox there, leaving server names alone.
* packaging: redirect a custom CUPS socket only when it is the one Flatpak mounted
Review (CodeRabbit): Flatpak picks the socket it mounts at /var/run/cups/cups.sock
with stricter rules than CUPS (flatpak-run-cups.c: a socket CUPS_SERVER, else the
first line spelled exactly "ServerName /path" in ~/.cups/client.conf, else the
default), while CUPS reads the keyword in any case and takes the last ServerName. The
wrapper now redirects only when CUPS' socket is the one Flatpak chose, so a job can't
reach a different server; otherwise CUPS fails on the missing path.
* print: a printer listing past its deadline kills and reaps lpstat
Review: the 10 s limit stopped waiting but left a hung lpstat and its thread
running, so repeated print attempts could pile them up. photocraft now runs the two
lpstat listings itself (craft-print's lpstat_command and an equivalent lpstat -e,
parsed by printers_parsed) and kills and reaps each one at the shared deadline. The
output is read on a thread that ends with the process, so nothing outlives the job.
* packaging: never redirect a CUPS_SERVER the sandbox was given
Review (CodeRabbit): Flatpak picks the socket it mounts from the host's CUPS_SERVER,
so one set by flatpak run --env or an override may not be what it mounted. The
wrapper now leaves any CUPS_SERVER alone and redirects only a client.conf socket that
matches Flatpak's choice; otherwise CUPS fails on the missing path instead of
reaching a different server.
* packaging: point CUPS at the mounted socket only when it is the one Flatpak chose, else fail
Review (CodeRabbit): with a custom socket listed first and the default last in
~/.cups/client.conf, Flatpak mounts the custom one at /var/run/cups/cups.sock while
CUPS picks the last line, finds that path, and talks to the custom server. The
wrapper now compares CUPS' socket with Flatpak's choice even when the path exists:
equal, CUPS is pointed at the mount; different, the tool fails with an error instead
of reaching another server.
Also (CodeRabbit):
- A printer named in the job goes to lp even when CUPS lists none: listing can be
forbidden while printing is not, and the portal can't honour a name.
- A failed lpstat -e (CUPS unreachable, listing forbidden) means the list can't be
told, so lp takes the job, instead of an empty list sending it to the portal.
- A listing longer than 1 MiB counts as no answer, instead of growing without bound.
- The kill test checks the process with kill -0, which works on every Unix.
- docs/printing.md: the only-printer fallback is on the lp and IPP routes, and the
portal is Linux only.