Commit Graph
109 Commits
Author SHA1 Message Date
Brandon Thomas 4cd6412a3c Merge PR #583 from NikitkaRa: PDF master header/footer text wraps and keeps mixed formatting (stacked on #580)
# Conflicts:
#	crates/render/src/lib.rs
#	crates/render/src/placed.rs
2026-10-14 13:30:43 -04:00
Brandon ThomasandClaude Opus 5.5 edaef792e0 Fix up merged PRs: Edit Points hits select their shape on right click; Hyperlink sound fields in #713's tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 13:11:36 -04:00
Brandon Thomas 337bd35a31 Merge PR #663 from NikitkaRa: Render: don't lay out table cell text that lands off the slide
# Conflicts:
#	crates/render/src/tests.rs
2026-10-14 13:09:05 -04:00
Brandon Thomas facca31f75 Merge PR #657 from NikitkaRa: Charts: draw axis titles 2026-10-14 13:09:05 -04:00
Brandon Thomas e7a106fcc3 Merge PR #639 from NikitkaRa: Render: cap dash count so a tiny dash on a huge shape can't crash on open 2026-10-14 13:09:03 -04:00
Brandon Thomas 2dcfbdaff4 Merge PR #600 from NikitkaRa: render: 3-D contours 2026-10-14 13:08:59 -04:00
Brandon Thomas d48d66b7f8 Merge PR #597 from NikitkaRa: render: 3-D light rigs and materials, per-side extrusion shading 2026-10-14 13:08:58 -04:00
Brandon Thomas 5d4e08733b Merge PR #595 from NikitkaRa: Render 3-D extrusions: sides under turned cameras (3-D slice 1)
# Conflicts:
#	crates/render/src/tests.rs
2026-10-14 13:08:58 -04:00
Brandon Thomas 4dea355f02 Merge PR #554 from NikitkaRa: Pptx: round-trip comments, links, shows, groups and inherited placeholders 2026-10-14 13:08:53 -04:00
Brandon Thomas 5334442eb5 Merge PR #507 from NikitkaRa: UI: seeded whole-window soak with memory and timing bounds 2026-10-14 13:08:47 -04:00
Brandon Thomas 6f2b41f236 Merge PR #502 from NikitkaRa: Engine: seeded editor soak tests; tiny charts no longer blank the slide
# Conflicts:
#	crates/render/src/tests.rs
2026-10-14 13:08:46 -04:00
Brandon Thomas bce94027ad Merge PR #486 from NikitkaRa: Charts: pie and doughnut data labels use the number format (#324) 2026-10-14 13:08:45 -04:00
Brandon Thomas 215fed001e Merge PR #478 from NikitkaRa: Render: cap RGBA conversion and bound the failed-image cache (#402) 2026-10-14 13:08:44 -04:00
Brandon Thomas 6484091328 Merge PR #476 from NikitkaRa: Render: budget shape path-gradient work on dense outlines (#404) 2026-10-14 13:08:44 -04:00
Brandon Thomas 271822164f Merge PR #437 from NikitkaRa: Metafile: clip EMF and WMF drawing to rectangle regions
# Conflicts:
#	crates/render/src/tests.rs
2026-10-14 13:08:42 -04:00
Brandon Thomas 9fab337cd2 Merge PR #157 from LloydNicholson: Charts: value axes start above zero when the values sit high, as in Office 2026-10-14 12:57:19 -04:00
Brandon Thomas 3635bdc8ba Merge PR #713 from nagasakimark: Slide show: click-triggered animations, per-slide state and hit testing 2026-10-14 12:53:34 -04:00
Claude 887ea1e706 Slide show: click-triggered animations, per-slide state and hit testing
Make the slide show behave like PowerPoint for interactive decks.

- Hit testing resolves the topmost visible shape under the pointer.
  Non-interactive shapes block shapes beneath them; the hand cursor
  shows only over interactive shapes.
- Click-triggered animations (interactive sequences) play on shape
  click, repeat after their last step, and apply in click order so
  cycling "score ring" shapes work.
- Each slide keeps its own progress: returning to a slide through a
  link or Back restores hidden shapes and animation state.
- A shape with a link and an animation follows the link immediately;
  its animation clock only runs while the slide is shown and resumes
  with the remaining time on return.
- With advance-on-click off, background clicks still play animation
  steps but never change slide.
- A click on a playing step completes it at once.

Docs (gaps, animation and slide show parity, roadmap) are updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 17:22:23 +09:00
Nikita Rakitin 8a5eec369f Render: skip laying out table cell text that lands wholly off the target 2026-10-14 04:22:37 +03:00
Nikita Rakitin fd1b0a1965 Charts: draw the axes' titles 2026-10-14 04:12:18 +03:00
Nikita Rakitin ca2af8fe30 Render: cap a stroke's dash count so a tiny dash on a huge shape can't abort on open 2026-10-14 03:14:28 +03:00
Nikita Rakitin ad7af60510 render: 3-D contours 2026-10-14 01:29:23 +03:00
Nikita Rakitin ab6051894d render: 3-D light rigs and materials; extrusion sides lit per side 2026-10-14 01:23:54 +03:00
Nikita Rakitin 27988aaa24 Render 3-D extrusions: sides swept behind the face under turned cameras
sp3d extrusionH (with extrusionClr, srgb or scheme) under a camera that
turns the shape now draws the shape's sides: its outline swept from the
back face to the front along the camera's view of the depth axis, in the
side colour shaded, before the face. camera::project3 projects points
off the shape's plane.
2026-10-14 01:19:18 +03:00
Nikita Rakitin 11e63e31e1 Lay out master header/footer text with the text engine in PDF pages
Notes pages and handouts lay out the master's header, date, footer and
page-number placeholders with deckcraft-text (render::place_master_texts),
so their text wraps in the placeholder and keeps mixed run formatting,
drawn as visible glyphs. Stacked on #580.
2026-10-14 00:44:09 +03:00
Nikita Rakitin f9d5a43174 Round-trip comments, links, shows, groups and inherited placeholders
An owned corpus of those element kinds survives open, save and reopen.
Paragraph default run properties, including a link, and action sounds
were dropped on save, so import and export now keep them.
2026-10-13 23:43:03 +03:00
Nikita RakitinandCursor e9315bc141 UI: seeded whole-window soak with memory and timing bounds
ui_soak_tests.rs drives the app through the egui test harness with seeded
random clicks, drags, keys (plain, Ctrl, Shift), typing and scrolling over the
sample deck. Every ten actions it checks that every document validates, the
selection is in range, undo, journal, thumbnail and texture caches stay
bounded, and no command or render panic was caught; at the end, that input
really reached the editor and the mean frame stays under 250 ms. Two seeds x
150 actions run in CI; DECKCRAFT_UI_SOAK_STEPS/SEED run it long.

Panics swallowed by the guards were invisible to tests: Session now counts
them (panics_caught) and deckcraft_render::panics_caught() counts render
panics drawn as blank. Textures::thumb_count exposes the thumbnail cache size.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 22:09:48 +03:00
Nikita RakitinandCursor 85833cf5f5 Engine: seeded editor soak tests; tiny charts no longer blank the slide
soak_tests.rs drives every non-file command with plausible and hostile
parameters over a ~100-slide deck, checking after each step that the
document validates, the selection is in range, the undo stack is bounded,
undo then redo restores the exact document, and every 100 steps that the
deck saves and reopens as .deckcraft and .pptx. Four seeds x 400 steps run
in CI (under a second); DECKCRAFT_SOAK_STEPS/SEED run it long.

The long soak found that a chart a few points wide panicked in f64::clamp
(label gutter min above max), and the render guard then blanked the whole
slide. chart.rs now uses a non-panicking clamp_soft for the gutters and the
zero line; a render test draws tiny charts next to a shape without the
guard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 21:50:23 +03:00
Nikita RakitinandCursor 7d23e4670b Charts: pie and doughnut data labels use the number format (#324)
Pie and doughnut data labels still went through fmt_num, which rounded
anything non-integral to one decimal (999.99 drew as "1000.0"). They now
use Chart::data_label like the other label paths (series format, else
axis format, else General), and fmt_num is gone.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 21:01:43 +03:00
Nikita RakitinandCursor 201ab63c48 Render: cap RGBA conversion and bound the failed-image cache (#402)
decode_at accepted up to 400 million pixels and then called to_rgba8, which
the decoder's allocation limit doesn't cover (a grey image converts to four
times its decoded size), and every picture that failed to decode was kept,
bytes and all, for the life of the process.

- Raster decodes check the RGBA size (512 MiB cap) from the header before
  decoding and again before the conversion.
- The failed-source cache keeps at most 256 entries and 64 MiB of encoded
  bytes, oldest forgotten first; a larger failed input isn't kept, and a hit
  must be the same Arc.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 20:52:20 +03:00
Nikita RakitinandCursor ce878ef74e Render: budget shape path-gradient work on dense outlines (#404)
A shape path gradient tested every raster pixel against every flattened
outline edge, so an outline with tens of thousands of segments cost
billions of tests and stalled rendering. The outline is now simplified
before rasterising so pixels x edges stays under 64M: points closer than
a raster pixel are dropped first, then every k-th point is kept, with
each polygon left closed and at least 8 edges.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 20:49:02 +03:00
NikitaandCursor 4fee02636a Metafile: clip EMF and WMF drawing to rectangle regions
INTERSECTCLIPRECT, EXCLUDECLIPRECT and EXTSELECTCLIPRGN limit what later records paint, including a region made of several rectangles. A rotated map stores the bounds of the clip rectangle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 17:57:34 +03:00
NetterSilver 35312529e1 slide.colorAt: the colour the slide is drawn with at a point (#367)
A read-only command, {slide?, x, y (slide units), scale?}: the slide is rendered and
the pixel at the point is returned as {color: "RRGGBB", alpha, x, y}. This is what the
Eyedropper takes, and what scripts and MCP use to read a colour off a slide. A point
outside the slide, a missing or non-numeric coordinate or an unknown slide is an error.
2026-10-13 16:41:57 +02:00
Brandon ThomasandClaude Opus 5.5 8ee082f257 Render: 3-D shapes' faces are lit even without a bevel
A shape with scene3d and sp3d but no bevelT was drawn in its flat fill
colour. PowerPoint lights the front face from the light rig whether or
not there is a bevel, so a plain 3-D rotated rectangle is lighter than
its fill. Model the face with the same threePt approximation as the
bevel (no rim), for solid fills.

Wild 3-D slides: s8 6.35 -> 4.26, s9 19.74 -> 17.68. Corpus unchanged
except lo tdf114848 s4 2.13 -> 1.94.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 238157d98e Render: 3-D cameras turn shapes (affine approximation)
A shape seen through a 3-D camera preset (isometric, perspective...) or
turned with a:camera/a:rot drew flat and front-on. PowerPoint turns the
shape's plane in space and projects it. Fitted black-box to its exports
(a picture with coloured corner markers under every preset and several
rotations; every fit within half a point on a 100 x 75 pt shape): points
about the centre are turned Rz(-rev) Rx(lat) Ry(lon), perspective cameras
then dividing by D / (D - z) with D about 5-16 shape sizes; a:rot turns
the other way about the horizontal and vertical axes. DeckCraft now draws
the shape under the affine transform that best fits its turned corners:
exact for orthographic cameras, within 2% of the size for perspective
ones (an affine map can't foreshorten). Oblique cameras leave a flat
shape as it is; depth (extrusion) is not drawn.

Wild synthetic set: camera presets 15.02 -> 6.35, 3-D picture styles
16.00 -> 7.72, extruded cameras 21.41 -> 19.74.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 ee71879f80 Render: pictures reflect their pixels
A reflection on a picture (PowerPoint's "reflected" picture styles) drew
nothing: the reflection painted the shape's fill, and a picture has none.
It now mirrors the picture itself, clipped to its outline, under the same
fade.

Wild synthetic set: picture effects slide 16.77 -> 16.00 (the rest is
3-D camera rotation, not modelled).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 7cb62d5197 Pptx/Render: picture fills with rotWithShape=0 stay upright
A shape's picture fill marked not to rotate with the shape turned and
flipped with it (rotWithShape was neither kept nor written: always 1).
PowerPoint keeps such a picture upright, stretched (or tiled) over the
box the rotated shape covers on the slide and clipped to the shape. Now
read, written (PictureFill::upright) and drawn so.

Wild synthetic set: picture fills on rotated/flipped shapes 12.89 ->
3.87.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 9238a915a2 Render: presets PowerPoint mitres by default get sharp corners; miter limit 8
An outline naming no join was always rounded. PowerPoint rounds most
presets but mitres some by default: classified per preset by comparing
its export (8 pt outline, no join) with round- and miter-joined renders:
the plus, right/up/down block arrows (not the left one), chevrons, stars
from five points up, the equation shapes, curved ribbons and the action
buttons. Miter joins also take PowerPoint's default limit of 8 widths
(kurbo's default was 4), so sharp star points no longer bevel off.

Wild synthetic set: joins slide 0.43 -> 0.21, outline-on-pattern slide
3.95 -> 3.76, preset galleries slightly better.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 2e68e54eec Render: gradients with rotWithShape=0 keep to the slide's axes
A gradient fill marked not to rotate with its shape turned and flipped
with it anyway. PowerPoint lays such a gradient out upright, over the box
the rotated or flipped shape covers on the slide (a 90 degree gradient on
a quarter-turned triangle still runs top to bottom). Linear and radial
gradients now do; rect and outline path gradients still follow the shape.

Wild synthetic set: gradients on rotated/flipped shapes 5.48 -> 1.34,
gradient angles slide 6.75 -> 1.95.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 239e41bdf6 Render: a picture's shadow covers the whole picture
The shadow of a picture is the picture recoloured to the shadow colour,
but drawing the picture left its pixel-space transform set, so the
recolouring rectangle (sized in points) covered only part of a picture
whose bitmap is bigger than it is shown: a 400 px photo at 240 pt cast a
shadow of its top-left corner only. The shape's transform is restored
before recolouring.

Wild synthetic set: framed pictures with shadows 7.67 -> 5.95, rotated
picture with a shadow 10.67 -> 10.07.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 cef6e1a8c8 Render: table borders draw their dashes, compound bands and diagonals
Explicit cell borders were stroked as plain solid lines (no dash, compound
or cap), and diagonal borders (lnTlToBr, lnBlToTr) were read but never
drawn. Both now go through the shape line stroker; diagonals are drawn
under the cell edges.

Wild synthetic set: border styles slide 5.67 -> 2.26, thick merged-cell
borders 1.20 -> 0.69.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 9d4541b8b4 Render: bevelled shapes lit like PowerPoint's default 3-D light (approximation)
A shape with a top bevel seen through a 3-D scene drew flat. Fitted to
PowerPoint's export of the bevel presets on a solid fill with the default
three-point light rig and matte material, DeckCraft now lights the face
and a band as wide as the bevel inside the outline as surfaces: Lambert
light from the upper left (azimuth 240, 45 degrees up), c * (0.453 +
0.731 * n.L) + 14.7 per channel, the band's normal tilting outwards by
the profile's slope (quarter circle by default, straight for angle).
Within about 15 grey levels RMS of PowerPoint on the circle bevel; other
profiles use the circle's, pictures get light and dark veils, and other
light rigs and materials (and anything without a scene) stay flat.

Wild synthetic set: bevel presets slide 5.20 -> 2.48, materials/rigs
13.25 -> 12.73.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 46dfb23dc5 Render: outline (shape) path gradients from an off-shape focus or a focus box
A "shape" path gradient with its focus off the shape (fillToRect on a
corner of an ellipse's box) filled solid with its last colour: the
position came from the nearest crossing of the ray from the focus with
the outline, and rays from outside cross it twice or miss. The contours
are the outline scaled about the focus, which a point first reaches at
the ray's farthest crossing; that is now used. A focus rectangle (rather
than a point) is the first colour throughout, with the colour running from
its edge to the outline, as PowerPoint draws it.

Wild synthetic set: shape path gradients 18.95 -> 3.54.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 675d20417e Pictures: black and white, inverted alpha, and PowerPoint's grey weights
- a:biLevel (Color > Black and White) was ignored. It is now read, written
  and drawn: white where the luminance reaches the threshold, else black
  (observed thresholds at 30/50/70% on colour swatches).
- a:alphaInv was ignored; an opaque picture with it is invisible in
  PowerPoint. Now read, written and drawn.
- Grayscale, duotone and saturation weighed channels 0.299/0.587/0.114;
  PowerPoint's export greys pure red to 54 and green to 182: Rec. 709
  weights (0.2126/0.7152/0.0722).

Wild synthetic set: recolour slide 7.60 -> 1.15, picture corrections
13.36 -> 7.36.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 bf877411fb Render: picture brightness with contrast as PowerPoint combines them
Brightness was added after the contrast stretch. Measured on PowerPoint's
export of grey ramps (5 x 5 grid of -80..80% brightness and contrast):
contrast scales about mid-grey (x(1+c) below zero, /(1-c) above) and
brightness adds b * 255 scaled by (1 + cf) / 2, half before the stretch
and half after; +40% brightness with +40% contrast maps black to 54, not
17. DeckCraft now matches the 25 ramps within 5 grey levels.

Wild synthetic set: brightness/contrast grid 15.93 -> 13.36, recolour
slide 8.74 -> 7.60.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 3b04dd14be Render: pictures with opposite corrections no longer share decoded pixels
The decoded-picture cache keyed adjustments with an xor-multiply mix in
which brightness b, contrast c and -b, -c collide (the sign bits cancel),
so of two copies of a picture, one +40% bright and contrast and one -40%,
both showed whichever was decoded first. The key is now a real hash.

Wild synthetic set: brightness/contrast grid 27.86 -> 15.93.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 772abb2154 Render: pattern fills blend neighbouring cells between whole-pixel sizes
Pattern tiles were sampled nearest-cell, exact when a pattern cell
(0.75 pt) is a whole number of output pixels (a 960-wide export of a
720 pt slide) but harsh otherwise: at 960 px for a 960 pt slide (0.75 px
per cell) PowerPoint shows greys where a pixel straddles two cells, and
DeckCraft showed only the two colours, in different places. The tile is
now sampled bilinearly. Fitted against PowerPoint's export of all 54
presets at 0.75 px per cell: mean error 0.067 (bilinear) against 0.082
(nearest) and 0.095 (area average); still not exact (narVert reads
255/128/0 in PowerPoint, 213/128/42 here). Unchanged at whole-pixel sizes.

Wild synthetic set: patterned backgrounds 21.15 -> 11.31 and
18.00 -> 9.75, pattern galleries 22.50 -> 19.44 and 13.96 -> 11.64.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 84e6c12543 Render: a group's outer shadow is cast by its children
An outer shadow set on a group (grpSpPr effectLst) was ignored. PowerPoint
casts it from everything in the group: the children are now drawn once
more under the shadow's offset, scale and skew (anchored on the group's
box), recoloured to the shadow colour and blurred, below the group.

Wild synthetic set: combined-effects slide (shadowed group) 2.00 -> 0.98.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 aafce0d2ef Render: gradient lines draw their gradient, heads included
A line filled with a gradient drew in its first stop's colour only. As
PowerPoint draws it, the gradient is laid out over the box the stroke
covers (the outline's bounds grown by half the line width, before the
line is cut back under its arrowheads), so a horizontal line's 90 degree
gradient runs across its width; arrowheads take the gradient where they
sit.

Wild synthetic set: gradient lines slide 8.43 -> 0.40; picture with a
gradient border 8.54 -> 7.67.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00
Brandon ThomasandClaude Opus 5.5 4773e4ee0f Render: tiled pictures take their size from the resolution they record
A tiled picture fill (including a blipFill with neither stretch nor tile,
which PowerPoint tiles) assumed 96 dpi. PowerPoint sizes a picture by the
resolution its file records: a 32 px tile saved at 90 dpi is 25.6 pt, not
24. The PNG pHYs chunk and JPEG JFIF density are now read (rounded to
whole dpi) and scale the tile.

Corpus lo/tdf128596 (tiled checkmark texture): 8.79 -> 0.52 mean diff
(it had drifted from 7.36 when tiles started snapping to whole pixels).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 08:16:41 -04:00