Commit Graph
15 Commits
Author SHA1 Message Date
dotCooCoo d823677f98 Merge main into fix/thumbnail-render-no-copy
# Conflicts:
#	crates/render/src/pattern.rs
2026-12-05 07:25:40 -08:00
dotCooCoo 2dc8a41ff8 Merge main into fix/webp-embed-icc 2026-12-04 15:24:10 -08:00
dotCooCoo 87778a672b WebP export: Embed ICC Profile writes the sRGB profile in an ICCP chunk
WebP had no embedIcc option, and its encoder never attached a profile,
so no WebP file carried one. WebP now takes embedIcc like JPEG, TIFF and
PSD, on by default: the file becomes an extended (VP8X) file holding the
sRGB profile in an ICCP chunk, lossless or lossy. embedIcc: false writes
the plain file as before.

- document.export and Export for Screens' settings.webp take embedIcc,
  and document.formats lists it for WebP.
- WebP Options (Export As and Export for Screens' Format Settings) gets
  an Embed ICC Profile checkbox.
- Docs: docs/mcp.md and docs/file-format-parity.md.
2026-12-04 15:24:10 -08:00
dotCooCoo dd5bec4cad Thumbnails: node renders and swatch previews become images without a copy
Every thumbnail and preview rendered a node, a region or a pattern swatch
into a byte buffer, and canvas::color_image then copied those bytes into a
new Vec<Color32> for the egui image. The Layers rows, Graphic Styles
large preview, Asset Export tiles, Graph Design preview, Navigator,
Transparency object and mask thumbnails, pattern swatches, Symbols panel
pictures and the Composite Fonts sample each paid that copy, and a
supersampled render allocated a second full-size buffer to downsample
into.

The renderer now renders these in words as well, as the canvas frame
already does: render_node_words, render_node_thumbnail_words(_with),
render_thumbnail_words, render_region_with_words and
render_pattern_swatch_words. node_pixels and the pattern swatch are
generic over the frame pixel type, and a supersampled render downsamples
straight into the buffer it returns. Each caller hands the words to
color_image_owned, which keeps the buffer. canvas::color_image has no
callers left and is removed.

Each moved path has a test that checks the image holds the buffer the
pixels were rendered into, and the render tests check that the words
hold the same bytes as the byte renders.
2026-12-04 11:38:01 -08:00
dotCooCoo deb403f6fa Canvas: a rendered frame becomes its texture image without a copy
color_image_owned cast the raster's Vec<u8> to egui's Color32, which is
aligned to 4 bytes, so bytemuck's try_cast_vec always failed and the
fallback copied the whole frame: about 20 MB at 2880 x 1800 on every
full-frame upload, despite its doc comment.

The renderer now also renders into a Vec<u32> (render_words,
render_plain_patch_words, render_region_words). Over transparency the
vello context draws straight into those words; frames that compose
offscreen, blend in CMYK, show an opacity mask or are supersampled
are converted once. color_image_owned takes that buffer and hands it
to egui as Color32 in place. The canvas frame, the render worker's
frames, pan fills, split panes, edit parts and the region previews
(stroke and artboard images, graphic style swatches, the PDF page
preview, the flattener preview) use it.
2026-12-04 07:17:21 -08:00
dotCooCoo 0c74698e55 Render: RenderOptions::hidden is a set, so each hidden check is one lookup
RenderOptions::hidden was a Vec<NodeId>, and the renderer checked each
node it visits against it with contains (node_checks::left_out and
Renderer::draw_node), so every check could compare against all k
hidden ids. The Fold Preview print hides every non-printing layer and,
with Show Fold Lines off, every object with a line role.

hidden is now a HashSet<NodeId>, so each check is one hash lookup. The
Fold Preview collects print_hidden's list into the set, and two tests
that built the field with vec! build it from an array. The field's doc
comment now names the Fold Preview print as its example.

New test a_render_leaves_out_every_object_of_a_large_hidden_set renders
2,000 strips with 1,000 of them in hidden and checks every strip's
pixel. It checks that hiding still works for a large set; the old Vec
drew the same pixels, so the test does not fail at run time without
the change.
2026-11-19 01:49:55 -08:00
dotCooCoo 2f7e60dd54 WebP: Lossy with a Quality setting writes a lossy WebP file
WebP Options has a Compression menu (Lossless, Lossy) and a Quality
slider from 0 to 100 that is enabled for Lossy. document.export,
document.serialize and Export for Screens take lossless: false with
quality (default 90) and write a VP8 file, with an ALPH chunk that keeps
the alpha exactly when some pixels are not opaque. Lossless stays the
default. A WebP quality above 100, or one that is not a whole number,
is refused with an error.

The encoder is the one craft-image-codecs already provides; no
dependency changes. The note that lossy WebP isn't available, its
catalog rows and the format text that described it are removed.
2026-11-16 12:30:56 -08:00
Dylan M. Taylor 1d6c4dcd14 chore(codecs): cut over remaining image/tiff/ccitt codecs to craft-libs 2026-11-14 21:19:30 +00:00
Sven Lafebre 499a74cedb Fix #6969: Rasterize to Grayscale or Bitmap makes a grayscale image 2026-11-12 23:04:50 +01:00
dotCooCoo 4fb98ceacd EPS export: the thumbnail is made from the preview instead of drawing the document again
With a TIFF preview, each EPS file's PNG thumbnail is now the preview
averaged down to the thumbnail's size and composited on white, so
export and Save draw the page once instead of twice. The thumbnail
keeps the size a 128 px render of the page has; a page that fits in
128 px gets the preview's own pixels. Without a preview the thumbnail
is still drawn.

- Rendered::area_resized averages premultiplied pixels over the area
  under each new pixel, weighting edge pixels by the share they cover,
  and returns an error for a 0 side or a buffer that does not match.
2026-11-11 17:32:07 -08:00
dotCooCoo aca44ae14e Render: the glow pan test checks fractional pans, and background docs say straight alpha
a_coarser_glow_kept_whole_draws_after_a_pan_as_made_again compared only
whole-pixel pans with a fresh render. At a fractional pan it now compares
the pixels right of the rectangle, where only the glow draws, with a fresh
render at the whole pixel nearest the pan (either neighbor on a half pixel).

RenderOptions::background and render_node_thumbnail's background are
straight-alpha colors, as over_background reads them; their docs said
premultiplied.
2026-11-09 17:15:41 -08:00
dotCooCoo 30f903bf60 Navigator: Panel Options sets the view box color and draws dashed lines as solid
The Navigator panel menu's Panel Options… is enabled and opens a dialog with
the view box color (a preset or a custom color; Light Red, today's color, is
the default) and Draw Dashed Lines as Solid Lines, off by default, which draws
dashed strokes without their dashes in the panel's thumbnail only. The
options are kept with the UI state, and ui.navigatorPanelOptions sets them.

RenderOptions::solid_dashes draws dashed strokes as solid lines, including
type strokes and the silhouettes of stroke effects.
2026-11-04 18:29:28 +07:00
dotCooCoo 95ce4d5cb4 Canvas: a pan or zoom-out fills the uncovered area with low-resolution art
Squashed from #4256 onto main.
2026-10-29 13:00:47 +07:00
Dylan M. Taylor 7e44df55a9 Make renderer and SVG module dependencies explicit 2026-10-28 05:03:00 +00:00
aiongg e0db48ba39 refactor(render): move lib.rs items to {blobs,bounds,clock,frame,geometry,node_checks,options,paint,renderer,renderer/images,renderer/nodes,renderer/paint,renderer/text,text_geom,threads}.rs 2026-10-26 22:01:25 +00:00