263 Commits

Author SHA1 Message Date
bflatastic 47f60ba5f8 M6: AVIF images open, import, place and drop (#2996)
A dropped or placed .avif was refused as an unsupported image. craft-image-codecs' avif-decode
feature (craft-video's pure-Rust AV1 decoder) is turned on in format and render, the file pickers
and open lists take .avif, and an AVIF's container rotation, mirror and crop apply as for HEIF.
The browser build refuses AVIF with the desktop-app message.
2026-12-04 08:36:39 +07:00
BFlat bafdf62ca9 fix(render): a frame that doesn't clip its content strokes under its children (#2931) (#2991)
A frame painted its strokes over its children whether it clipped them or
not, so a child laid across its edge (an outlined text field's floating
label) had the border cut through it. A frame that doesn't clip its
content now strokes before its children, on the canvas and in the SVG,
PDF and Vector Drawable exports; a clipping frame still strokes over
them.
2026-12-04 01:47:04 +07:00
BFlat 06b001bec9 M4: paste keeps a layer's place in another frame, Paste to replace takes SVG, pen clicks and line gradients (#2967) (#2975)
* M4: gradient handles on a straight line show where their stops paint (#2967)

* M4: a snapped pen click that wobbles pulls out no handle (#2967)

* M4: paste into another frame keeps the place the layers had in theirs (#2967)

* M4: Paste to replace takes SVG another app put on the clipboard (#2967)

* docs: parity log for #2967
2026-12-03 18:07:27 +07:00
BFlat fb7d241103 fix(render): touching rectangles leave no hairline where they meet (#544) (#2927)
* fix(render): touching rectangles leave no hairline where they meet (#544)

* fix(render): snap a box side only where neighbours meet its whole length (#544)

A side moved when any part of it touched a sibling, so a long box beside
a short one lost the exact coverage of the part touching nothing. Edges
that differed by under 1/4096 unit also counted as shared, closing
sub-pixel gaps at high zoom.

Now a side snaps only when sibling sides within a sixteenth of a device
pixel cover its whole length. Sides that match round to the nearest
pixel alike; a short side against a longer one rounds outward over it
and the longer one stays exact.

* fix(render): round a short side outward only over opaque boxes (#544)

A short side meeting part of a longer one rounds outward over it, so
the shared pixel strip is drawn by both boxes. With a translucent fill
or node opacity that strip showed darker. It now rounds outward only
when the box and every neighbour on that line are opaque and normally
blended; otherwise that side keeps its exact edge.

* fix(render): sides that meet round from one shared line (#544)

Sides within the tolerance of each other counted as shared but each
rounded its own position, so a pair straddling a half pixel landed on
different whole pixels and left a one-pixel gap. Matching sides now all
round the same line, the lowest of their positions.

* fix(render): tiny layers in the zoomed-out preview snap shared sides too (#544)

Rectangles under two device pixels skip splat_fills and go straight to
splat_subtree, so a block of them still showed a lighter seam far
zoomed out. splat_subtree now fills the snapped box as well, except
under a translucent parent, whose opacity it applies to each layer on
its own.

* fix(render): leave layers the editor draws itself out of shared edges (#544)

A sibling in the render's skip list isn't drawn, so a box beside it
kept its exact edge rather than snapping to meet it.
2026-12-03 09:49:53 +07:00
BFlat 11d12696d8 Merge pull request #2956 from elliotttate/perf/2955-image-cache
perf(render): pages of a large image-heavy file stop decoding their images again on every zoom (#2955)
2026-12-03 06:32:56 +07:00
BFlat 1cfe415080 Merge pull request #2920 from storytold/bug/253-2915-figcraft-png-jpg-webp-expor
M6: PNG, JPG and WebP export past 16384 px a side names the limit and the size it asked for (#2915)
2026-12-03 06:17:56 +07:00
bflatastic d7900bf0f0 Merge remote-tracking branch 'origin/main' into pr/2956-367
# Conflicts:
#	crates/render/src/images.rs
2026-12-03 05:49:41 +07:00
BFlat 69ca66bfdd Merge pull request #2925 from storytold/feat/291-1013-feature-request-figcraft-ad
M6: a layer with a video fill shows a video mark in the layers panel (#1013)
2026-12-03 05:09:27 +07:00
bflatastic 026dd16a7f fix(render): an export passes by the border the canvas padded around an averaged copy (#2955) 2026-12-03 05:04:14 +07:00
bflatastic 54b5f2e7d5 fix(render): an export passes by a canvas copy averaged from a larger one under the same key (#2955) 2026-12-03 05:00:49 +07:00
elliotttate be04080442 perf(render): pages of a large image-heavy file stop decoding their images again on every zoom (#2955)
The decoded-image cache held 256 copies whatever their size, fewer than one
page of such a file shows, so a render dropped copies it needed again. Image
adjustments ran per pixel at full size after every decode, and a copy at a new
size, or a shadow's opacity check, decoded the image again.

- The cache holds up to 4096 copies within its unchanged 512 MB budget.
- Adjustments are looked up in a table of the colours an image has met (the
  same results).
- A canvas copy at a smaller size is averaged down from a larger cached copy;
  exports reuse only the full decode, so their pixels are unchanged.
- An image's opacity is remembered with its full size after one look.

Tests: image_reuse_tests; timings: real_file_bench_tests (FIGCRAFT_BENCH_FILE).
2026-12-02 16:26:57 -05:00
bflatastic 1be2009165 Video mark: peek at a file's first bytes and key the cache to where they come from 2026-12-03 04:00:31 +07:00
bflatastic 0e0f59064d M6: a layer with a video fill shows a video mark in the layers panel (#1013) 2026-12-02 16:41:26 +07:00
bflatastic 32b5f67b75 M6: PNG, JPG and WebP export past 16384 px a side names the limit and the size it asked for (#2915) 2026-12-02 16:02:08 +07:00
bflatastic 449fa747b3 M4, #1680: notched (inside square) corners, and .sketch corner styles stay live 2026-12-02 15:32:57 +07:00
BFlat 5d93db5398 Merge pull request #2863 from storytold/fix/2777-unclipped-frame-spread
M3: a frame that doesn't clip its content ignores its drop shadows' spread (#2777)
2026-12-01 20:53:15 +07:00
BFlat adcb55d679 Merge pull request #2857 from storytold/fix/2853-glass-drag
M8: a layer with effects drags smoothly: glass and background blur are rendered again for where they are, off the canvas render (#2853)
2026-12-01 19:56:43 +07:00
bflatastic 1daffc8bd3 M3: a frame that doesn't clip its content ignores its drop shadows' spread (#2777)
A frame, component, component set or instance with Clip content off now draws its
drop shadows as its outline is, only moved by their offset: no ring for a positive
spread, no shrinking for a negative one. A rectangle or a clipping frame still grows
and shrinks them, and turning Clip content back on brings the spread back (the
stored value is unchanged).

The canvas, PNG/JPG/WebP, PDF and SVG exports agree, and the paint and export
bounds leave no room for the ignored spread. Inner shadows keep their spread.
2026-12-01 19:44:48 +07:00
bflatastic 5875ca5522 fix(doc,engine,render): unreadable lazy images aren't equal, share save prep, video bytes after rebase (#1313)
- ImageData equality: two lazy images that both fail to load no longer compare equal; equal
  content-hash keys compare without reading either store (as the PR describes).
- save_to and encode_at share FileSnapshot::prepared instead of duplicating the doc prep.
- render: video players read lazy bytes through ImageData::bytes (new on main since the PR).
- docs/file-format-parity.md: revision row for #1313.
2026-12-01 18:32:42 +07:00
bflatastic f4ef76aa72 Merge main into perf/lazy-images-1313
Resolves conflicts in crates/engine/src/lib.rs (keep both test modules) and
crates/penpot/src/export.rs (keep main's orientation check on lazily loaded bytes).
2026-12-01 18:32:41 +07:00
bflatastic 3baca4bc06 M8: an ending glass sprite shows the backdrop of where it stopped (#2853)
Once the drag ends, the sprite keeps asking for and showing a backdrop render of its last
place until the canvas render replaces it, so a render still on its way when the button goes
up isn't left showing an older place's backdrop. A render test checks that a layer dragged
together with the pane, under it, shows through the pane as it would where both are.
2026-12-01 18:25:40 +07:00
bflatastic e5b6d3b7c4 Tests: the moved-pane test reuses the glass bench scene 2026-12-01 18:06:44 +07:00
bflatastic a76aba9278 M8: a layer with effects drags smoothly: its own effects move in the drag sprite, and glass or a background blur is rendered again for where it is on a thread of its own (#2853)
A dragged layer with any effect on it used to give up the drag sprite, so every pointer
move asked the canvas for a new render (about 20 ms each for a 600 x 360 glass pane over
stripes in a debug build here; 48 ms per move in the release glass bench at 200 %), and the
layer stuttered behind the pointer.

- The sprite now takes layers with effects of their own (drop and inner shadows, blurs,
  noise, texture, glass): render_area draws them as the page does.
- A background blur or glass in the sprite reads what lies under it where the layer is now:
  figcraft_render::render_area_moved draws the layers where they started but reads their
  backdrop at the drag's shift. A thread of the sprite's own renders it for the latest shift
  and hands the image back; the sprite keeps moving with the outline every frame and shows
  the newest render. The canvas renders nothing until the drop.
- The glass shading loop runs its rows in parallel outside a parallel render (exports and
  the sprite), as blurs already do; bands of a canvas render stay on their own thread.
2026-12-01 17:15:47 +07:00
BFlat 0bb1183a8f Merge pull request #2846 from storytold/fix/2837-dark-sections
M1: sections draw in dark tones of their colour while the interface is dark
2026-12-01 15:27:28 +07:00
bflatastic 142ed2d1fd M1: sections draw in dark tones of their colour while the interface is dark (#2837)
On a dark interface the canvas draws white sections, the section colour presets and the default
section border in dark tones instead of bright light blocks, and the Section color swatches show
those tones. A custom colour draws as it is. The stored colour stays, so the light theme, exports,
thumbnails and the file are unchanged; switching the theme redraws the canvas.
2026-12-01 14:47:26 +07:00
bflatastic d98ddb5f89 M6: video fills: MP4 and MOV videos fill layers and play in the presenter
A video is kept as an image fill's source, the file itself, like an
animated GIF: place it, import it, drop it on the canvas or pick it in the
fill picker, on any layer that takes an image fill. The canvas,
thumbnails and exports show its first frame; the presenter and the
preview play it muted and looping, one frame decoded at a time on the
GIF clock. H.264 video in MP4 and MOV, read and decoded in pure Rust by
craft-libs' craft-media and craft-video (no new third-party crates).
2026-12-01 13:42:17 +07:00
BFlat 469c6e84ae Merge pull request #2764 from denisg0mes/heic-images
M6: HEIC and HEIF photos go into a design, upright
2026-12-01 10:26:36 +07:00
bflatastic 942c8f85e0 format, render: HEIC stays desktop-only, like the other codecs left out of the browser
The heif codec feature moves from the workspace line to the desktop-only
entries of figcraft-format and figcraft-render (#2770), craft-heif is only
probed on desktop, and the browser refuses a HEIF with the same "desktop app"
message as TIFF. Fixes the wasm build.
2026-12-01 09:31:27 +07:00
bflatastic 56adc746d4 Merge main into #2764 2026-12-01 09:06:59 +07:00
bflatastic 2f18e65191 Merge main into #2776 2026-12-01 08:53:17 +07:00
Bryton Cooper b9e61e7323 chore(format,render): migrate lazy image store and streaming save to craft-zip after #2587/#2771 2026-11-30 07:52:39 -07:00
Bryton Cooper 3587c37513 perf(format,doc,engine): load .figcraft images lazily with bounded LRU and streaming save (#1313) 2026-11-30 07:39:12 -07:00
Jindřich Šaršon f36229cf02 Image exposure follows the reference tool's curve
Exposure multiplied the encoded channels by 2^(2e), so +0.42 left a
photo some 20 levels too dark and -1 crushed it. It now runs each
cube-rooted OKLab cone response through a soft limit at a gain of
2^(2e): the darks brighten most, white stays white, and brightened
colours fade towards white, as renders of grey and colour ramps show.
The colour crate exposes the cone conversion it already had.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
2026-11-30 10:56:47 +01:00
Jindřich Šaršon 5681a5527e Drop shadows of a pass-through layer blend with the backdrop
Only a layer in a blend mode of its own (Normal included) groups its
blended drop shadows; a pass-through frame's burn into what lies under
it, as the reference tool draws the glass buttons' dark ring.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012eBDgsvRwsSRpWeWrzabVY
2026-11-30 10:55:53 +01:00
Codex 3a2f093848 Align browser format policy with the reviewed dependency PR 2026-11-30 02:27:43 +01:00
Codex d968e3eece Keep uncommon format conversion on desktop to fit the browser budget 2026-11-30 02:19:42 +01:00
Livio Sidler 4fc4d7f7f8 Merge main: the checklist's command count is main's 2026-11-30 00:41:57 +01:00
Denis Gomes 9c73a6bf81 M6: HEIC and HEIF photos go into a design, upright
Figma takes HEIC images; FigCraft refused them, its docs waiting for a Rust
decoder. craft-libs has one now: craft-image-codecs' `heif` feature, which
craft-heif backs with heic-rs (pure Rust, no `unsafe`, MIT OR Apache-2.0).
This turns it on, so Place image, a drop on the canvas, File > Open and an
image fill's replace take iPhone and Mac photos. The file is kept as is.

A HEIF records its rotation, mirror and crop in the container (irot, imir,
clap); they are part of the picture and its EXIF only mirrors them. FigCraft
draws other formats' stored pixels whatever their EXIF says, so
`figcraft_format::keeps_stored_orientation` answers per file, and the
renderer's decode, the file thumbnails, the Penpot export and the size a
layer gets all go by it: the layer's size and the pixels drawn in it agree.
The size comes from craft-heif's probe of the container, without decoding.

Tests: heic_import_tests: a 64 x 32 photo stored a quarter turned comes in
32 x 64, black above and white below, from Place and from File > Open.
2026-11-29 17:37:15 -05:00
BFlat b8155c5301 Merge pull request #2754 from hoangquocvietuet/fix/2567-text-run-blend
M3: a text run's blend fill in a shadowed pass-through frame blends with the backdrop (#2567)
2026-11-30 00:09:51 +07:00
hoangquocvietuet ebf39d0e0d M3, #2567: a text layer's own blend fill counts too; read paints through own_paints; fail the font skip when fonts are required 2026-11-29 16:22:59 +00:00
BFlat 06da46115b Merge pull request #2739 from LS254/fix/clip-covers-corner-style
M8, #2738: a chamfered or concave corner counts as cut off square for a clip that takes in the view
2026-11-29 23:15:18 +07:00
hoangquocvietuet 1dbea4b552 M3, #2567: a text run's blend fill in a shadowed pass-through frame blends with the backdrop 2026-11-29 15:56:50 +00:00
hoangquocvietuet 261d9d3847 M3, #2567: a text run's blend fill in a shadowed pass-through frame blends with the backdrop (failing test) 2026-11-29 15:56:50 +00:00
Livio Sidler 6ba014e44c Merge main into #2735: outline shadows the layer hides are left out before they are grouped, and the no-layer path is for shadows that blend normally
With #2533 a layer's drop shadows are collected and, when one blends by a mode of its own,
drawn into a group first. shadows_hidden now filters what is collected, and shadows_only
is false for a shadow with another blend mode, so such a layer takes the path that groups.
2026-11-29 13:52:15 +01:00
BFlat 47ac7dcf5e Merge pull request #2732 from LS254/fix/vector-stroke-align
M4, #2731: a vector's inside or outside stroke aligns only its fill's outline
2026-11-29 19:48:47 +07:00
BFlat 738a2d77e2 Merge pull request #2737 from LS254/perf/shadow-gradient
M8, #2736: a soft shadow under an opaque gradient is cast from the outline, as under an opaque colour
2026-11-29 19:30:51 +07:00
Livio Sidler a6920f0c5d M8, #2736: the gradient card's test looks for the shadow under the card, not on it
From the review of #2737: the card is black, so the darkest pixel of the view said nothing
about a shadow.
2026-11-29 12:42:23 +01:00
Livio Sidler 0aa4b2f2fc M8, #2738: a chamfered or concave corner counts as cut off square where a clip or a box is tested against a view
clip_covers and in_box tested such a corner as the arc of a round one, which cuts off
less: a clipping frame's children showed in the corner the chamfer cuts off.
2026-11-29 12:41:31 +01:00
Livio Sidler ec7a882508 M8, #2734: hidden shadows are left out behind round corners only, and an edit redraws a shadow that this render casts from pixels
From the review of #2735:
- shadows_hidden asks clip_covers, which takes a corner for an arc: a chamfered or concave
  corner cuts off more, and a shadow that shows there was left out.
- Zoomed out with levels of detail, and with a backdrop effect, draw_layer casts a shadow
  from the layer's pixels although the layer has an outline to cast from. What an edit
  redraws now asks the same question draw_layer does (draw::outline_cast).
2026-11-29 12:39:24 +01:00
Livio Sidler 1d18f795d0 M4, #2731: a vector's lines are placed by what is filled beside them, and trimmed only where they end on the outline
From the review of #2732:
- A segment is on the outline when the fill lies on one side of it, in the fill or outside it
  when on both or neither. The loops alone don't say: a loop inside another that turns the
  same way bounds nothing under the non-zero rule, and was stroked as outline.
- An inside stroke cut every line in the fill by the fill. Now only what shows past the
  outline around a point where such a line ends on it: a line that goes through the fill
  keeps its parts outside, and one close to the edge its whole stroke.
- A segment's middle comes from its own curve, not from a copy of the network.
- The stroke cache's key takes in the segments and the points' places: the loops name
  segments by number, and two networks can have the same path with other numbers.
2026-11-29 12:34:14 +01:00