Commit Graph
804 Commits
Author SHA1 Message Date
dotCooCoo 1e9ca6075b Merge main into fix/raster-effect-whole-object-reuse 2026-12-05 11:22:22 -08:00
dotCooCoo 901f78bedd Effects: a whole-object raster keeps its origin across whole-pixel pans of a centered view
The canvas pans by moving the view's center, which leaves rounding error
in the view's translation (for example -13680.000000000002). Flooring
the raster's left or top edge then put the origin one pixel lower, the
width or height grew by a pixel, the scale changed, and the whole object
was filtered again. The origin is now rounded to 2^-20 device pixels,
ties to even, before it is floored, as the sizes already were.

pans_of_a_centered_view_draw_the_whole_object_raster_again now pans
across and down in turn at scales 56, 72, 96 and 120, with centers on
whole points too.
2026-12-05 10:48:05 -08:00
dotCooCoo 4c6f8e6f10 Effects: a whole-object raster keeps its scale across whole-pixel pans of a centered view
The canvas pans by moving the document point at the center of the view,
and the device rect of the object's reach then shifts by whole pixels
plus floating-point rounding. The size of the raster's region is now
rounded to 2^-20 device pixels before its scale and dimensions are
computed, so a whole-pixel pan at 9600% or 5000% gives the same scale
bits as the first frame and draws the kept raster instead of filtering
the object again.

New tests cover pans of a centered view at both scales, and each check
that a kept raster was made for this output, scale and size.
2026-12-05 09:26:29 -08:00
dotCooCoo 7645a787b0 Render: a pattern raster takes its region and size as one argument
rasterize_as took eight arguments and carried an allow for Clippy's
too_many_arguments lint. The region and the pixel size it fills now go
in as one pair, so the function stays within the limit without the
allow.
2026-12-05 07:28:29 -08:00
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 545f6f97cf Effects: kept effect rasters of brushed strokes follow plug-ins used in brush art
The brush library now notes whether any brush art holds a plug-in
effect. Content with brushed strokes then reads the plug-ins installed,
so installing or removing a plug-in that brush art uses filters the
stroke's effect raster again instead of drawing the old pixels after a
pan.
2026-12-05 06:39:15 -08:00
dotCooCoo 9e49dbdd28 Effects: kept effect rasters of brushed strokes follow symbols and patterns in brush art
Brush art can stamp symbols and use patterns, so content with brushed
strokes now reads every document resource, as content showing symbol or
pattern art already does. Editing a symbol that a scatter brush stamps
filters the stroke's effect raster again instead of drawing the old
pixels after a pan.
2026-12-05 05:49:34 -08:00
dotCooCoo b843077e9e Effects: kept effect rasters follow image smoothing in brush art and symbol editing
Brush art can hold images, so content with brushed strokes now counts
as reading images and its effect raster is filtered again when image
options such as bitmap smoothing change. While symbol editing hides the
instance it started from, the effect raster of a group holding that
instance is filtered again instead of showing the instance under the
editing copy after a pan.
2026-12-05 05:29:48 -08:00
dotCooCoo 383a5aa87f Effects: a whole-object raster draws again only after a pan by whole pixels within rounding
A raster of the whole object kept at a lower resolution now draws after a
pan only when the pan is whole to within floating-point rounding (a
tolerance scaled to the translation, between 1e-9 and 1e-6 px per axis,
and never looser than the 1e-6 px check rasters cropped to the view use).
A width-capped raster panned vertically by 40.0000001 or 39.9999999 px
keeps its scale, size and rounded origin, so the looser check drew it on
a shifted sampling grid; it is now filtered again, and a pan of exactly
40 px still draws the kept raster.
2026-12-05 05:04:37 -08:00
dotCooCoo 19808d2b03 Effects: kept effect rasters follow Show Images in Outline Mode
A layer with effects can hold a sublayer with Preview off, whose images
draw as frames or as grayscale pixels depending on Show Images in
Outline Mode. The raster inputs of content that reads images now include
that setting, so toggling it filters a whole-object raster kept across
pans again.
2026-12-05 00:40:53 -08:00
dotCooCoo 08face9fa3 Effects: kept effect rasters follow the render mode and trim one frame at a time
A whole-object raster kept across pans holds offscreen groups and masks
drawn in the frame's render mode, so the raster inputs now include
RenderOptions::precise and switching it filters the content again.

When the effect cache is over its budget, the trimmer goes through the
frames from the least recently drawn: within each frame it first turns
whole rasters into their view copies and only then evicts that frame's
entries. An older shadow or raster now goes before a newer whole raster
loses its whole image, and a shadow drawn in the same frame as a whole
raster stays cached when the view copy alone makes room.
2026-12-05 00:17:48 -08:00
dotCooCoo f30d267aca Effects: test that a pan by part of a pixel filters a width-capped whole-object raster again
A 2000 x 1 pt bar with Torn Edges at 6400% has a whole-object raster
capped at the widest raster side, so a vertical pan by part of a pixel
can leave its scale, size and rounded origin unchanged. Only the
whole-pixel pan check then keeps the raster from being drawn on a moved
sampling grid; the new test covers it.

The PixelEntry::view doc now says which lower-resolution rasters keep a
view tag: those of an image kept for one placement and those a drag
keeps.
2026-12-04 23:34:11 -08:00
dotCooCoo 8a014ee9e1 Merge main into fix/raster-effect-whole-object-reuse 2026-12-04 22:32:12 -08:00
dotCooCoo d445184a1f Effects: a cached effect raster follows whether placed documents draw from background bitmaps
Placed documents draw exactly instead of from a background bitmap in
Overprint Preview, under a proof, in Outline and in other inks. A
raster's inputs now hold that choice, from the same check that draws
placed documents (placed_document::progressive_bitmaps), so turning
Overprint Preview on before a bitmap is ready no longer leaves its
placeholder in a raster kept across pans. The count of bitmaps made is
still hashed whenever background bitmaps are on, since art drawn in
another ink, such as an opacity mask, can still use them.
2026-12-04 22:28:30 -08:00
.CooCoo 4a7fe04e81 Merge pull request #10888 from dotCooCoo/fix/targa-color-model
Targa export: a Color Model option writes grayscale files
2026-12-04 22:27:33 -08:00
dotCooCoo 4f421c32ae Effects: a cached effect raster follows the edge smoothing mode and ready placed bitmaps
Art and Type edge smoothing share a coverage threshold, but Type snaps
glyphs to the pixel grid, so a raster's inputs now hold the mode itself.

While placed documents draw in the background, a raster of content that
holds a placed document, shows symbol art or uses brushed strokes is
made again once a background bitmap is ready. Content with only ordinary
images, or painted only with patterns (whose tiles draw without
background bitmaps), keeps its raster.
2026-12-04 22:06:35 -08:00
dotCooCoo 4faf2fe671 Effects: a new guide style or Layer Options setting draws a cached effect raster again
A raster of a layer's or group's effects can hold paths made into
guides, drawn in the guide color and style, and sublayers drawn as their
Layer Options show them on screen. Its inputs now include the guide
color and style and whether Layer Options show, so a whole-object raster
kept across pans is not drawn again with the old look.
2026-12-04 20:57:50 -08:00
dotCooCoo e51721747a Effects: hiding or skipping template layers draws a cached effect raster again
A raster of a layer's effects can hold a template sublayer. Its inputs
now include whether template layers are hidden or skipped, as they
already include whether guides are hidden, so a whole-object raster
kept across pans is not drawn again with the template's art in it.
2026-12-04 19:30:42 -08:00
dotCooCoo e76423a1e2 Tests: check each Targa color channel on its own
test-lint rejects assert!(...all(...)) without a length check, which
failed the gate. The test now compares the three channels one at a time
with the same tolerance.
2026-12-04 19:10:05 -08:00
dotCooCoo ce0055d8ba Tests: the bitmap glyph raster inputs test builds its frame with the hidden-objects fingerprint 2026-12-04 18:48:48 -08:00
dotCooCoo 96d93c70d9 Merge main into fix/raster-effect-whole-object-reuse 2026-12-04 18:27:48 -08:00
dotCooCoo d3d6e81975 Targa export: a Color Model option writes grayscale files
Targa Options gets a Color Model menu, RGB or Grayscale, and
`document.export` takes it as `colorModel` (`rgb` or `gray`, as BMP
does). Grayscale writes an uncompressed grayscale file (image type 3)
at 8 bits per pixel, flattened on white, or 16 bits with an 8-bit
alpha; omitting `depth` with `gray` gives 8 bits. `cmyk`, an unknown
model and a grayscale depth of 24 or 32 bits are refused with an error.
Switching the model in the dialog moves a depth the new model lacks to
that model's default.

The transparency rule of the dialog's background list now follows the
depth: 16 and 32 bits keep transparency, 8 and 24 bits are flattened.

Docs: docs/mcp.md, docs/control-protocol.md, docs/target-app-parity.md.
2026-12-04 16:12:01 -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
.CooCoo 8af0c595eb Merge pull request #10840 from dotCooCoo/fix/canvas-upload-no-copy
Canvas: a rendered frame becomes its texture image without a copy
2026-12-04 14:19:57 -08:00
dotCooCoo 77a8a01375 Effects: a raster effect that looks across the whole object keeps its raster across pans
An effect that reads anywhere in its object (Torn Edges, Cutout, Radial Blur,
SVG filters) is filtered over the whole object at a lower resolution once the
object passes the pixel budget. That raster was stored cropped to the view, so
every pan missed it and filtered the object again: about one second a frame at
6400% in a 1280 x 800 view.

- The raster of the whole object is kept and drawn again after pans by whole
  device pixels, while its origin, scale and size match what a fresh render
  makes and the output grid also moves by whole pixels.
- Each frame draws it through a copy resampled to the view's pixels, kept for
  frames through the same view.
- When the effect cache is over budget, whole rasters give way to their view
  copies before any entry is evicted, and a copy that alone exceeds the budget
  is not made.
- The objects a render hides are part of a cached raster's inputs, so hiding a
  member of an object with a cached effect filters it again.
2026-12-04 14:15:31 -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 fe4c78c976 Merge main into fix/bitmap-smoothing-every-view 2026-12-04 10:11:16 -08:00
.CooCoo edcb80db38 Merge pull request #10429 from dotCooCoo/feat/3d-rendered-tier
3D: Render Settings › Rendered draws the solid as a lit image with shadows from every light
2026-12-04 09:24:53 -08:00
.CooCoo a3c01a540c Merge pull request #10791 from dotCooCoo/fix/raster-effect-zoomed-drag
Effects: a zoomed-in drag filters raster effects once and moves the raster
2026-12-04 09:24:39 -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 afc4de9b07 Render: a full-frame render hands its pixels over without a fill and a copy
Renderer::render, render_node, render_pattern_swatch and the image of
Effect > Rasterize copied the rendered pixmap into a new Vec<u8>. They
now take the pixmap's buffer and cast it to bytes in place
(group::into_bytes); a buffer the cast cannot take is still copied.
The target pixmap with nothing under it is allocated zeroed
(group::blank_pixmap) instead of being filled pixel by pixel. At
2880x1800 that removes one 20.7 MB fill and one 20.7 MB copy from every
whole-frame render. The pixels are the same bytes.

Part of #1172
2026-12-04 01:41:07 -08:00
dotCooCoo 5fe1391a35 Preferences: image smoothing reaches type rasters, pattern tiles and placed documents
With File Handling › Display Bitmaps as Anti-aliased Images (or its Pixel
Preview setting) off, images inside pattern tiles and placed documents now
show hard-edged pixels, and the tile or placed bitmap is drawn without
smoothing too. Tiles and placed bitmaps made with and without smoothing are
kept apart, and a raster kept for type with color bitmap glyphs is made
again when the setting changes.

- Tests: a 2x2 checker scaled up in a pattern tile, a placed document and
  the canvas shows only its own colors with smoothing off and greys with it
  on; type rasters change their inputs with the setting.
- Docs: docs/mcp.md and the preference help no longer note pattern tiles
  as an exception.
2026-12-04 01:31:56 -08:00
dotCooCoo a7a97bcc5b Effects: a zoomed-in drag filters raster effects once and moves the raster
Once an object with raster effects covers more than the pixel budget on
screen, its raster is cropped to the view. While dragging, such content
was rendered within the drag budget and no raster was kept, so every
frame of the drag painted the content and ran the whole effect chain
again: about 0.5 s a frame with Texturizer at 6400%.

A drag now keeps that raster when every effect only looks nearby. The
raster covers the view with a margin around it, within the drag budget
(at full resolution when the frame's crop fits it), and records the part
whose pixels the effects decided with all they look at. Later frames of
the drag move it with the object, as the whole-raster move already does,
while what the frame shows of the content, with the sampling footprint
of a lower-resolution raster, lies inside that part. A move or pan past
it filters again. Still frames are unchanged: a drag's raster never
draws outside a drag, and the frame after the drag renders as before.

Part of #2558. Builds on the approach of #2779 by 00xJS.
2026-12-03 12:17:46 -08:00
dotCooCoo 014ed9a190 Merge main into feat/3d-rendered-tier 2026-12-03 10:38:52 -08:00
dotCooCoo 9c11c47f75 Doc tests: unsafe code is denied in doc tests too
Rustdoc builds each doc test as its own crate, without the workspace's
`unsafe_code = "deny"` and without a library's `#![forbid(unsafe_code)]`,
so a doc test holding an `unsafe` block passed `cargo test --doc`.

- Every library root now carries `#![doc(test(attr(forbid(unsafe_code))))]`,
  or `deny` in cad, eps and metafile, which rely on the workspace lint.
- `cargo xtask layers` reports a library whose doc tests are missing the
  attribute, or use `deny` where the library forbids unsafe code.
- AGENTS.md names the rule next to the `unsafe` allowlist.
2026-12-03 09:51:28 -08:00
.CooCoo 61ac3d5d57 Merge pull request #10647 from dotCooCoo/fix/raster-400-worker
Canvas: pans at high zoom keep the paths the canvas drew while waiting for the worker
2026-12-03 08:21:40 -08:00
.CooCoo 4f0d45d555 Merge pull request #10444 from dotCooCoo/fix/web-image-paste-speed
Paste: a bitmap copied in another app is not encoded and decoded again
2026-12-03 07:25:43 -08:00
dotCooCoo e00a12ac60 Render: only a measurement ages the canvas renderer's caches
Renderer::changed set the measuring flag before it compared anything, so
comparing a document with itself still made the next
finish_measurement_only sweep the paths of the last frame. The flag is
now set where the diff measures an object through the renderer, in the
Trim View check (children_blend caches the groups it reads), and when a
change outside the layers redraws everything, so bounds kept for old
symbol definitions still expire.
2026-12-02 18:14:13 -08:00
dotCooCoo 629ad05f3c Render: frames that wait for the worker keep the canvas renderer's paths
The canvas calls Renderer::finish_measurement_only in every frame that
waits for the render worker. Since 51d3dcf2ea each call ages the
renderer's caches, so after four waiting frames the paths it drew were
swept even when nothing was measured, as after a zoom or a pan. The next
frame the canvas rendered itself built every path again: a pan step at
400% on a 6,000-path document took 25 to 34 ms instead of 8 to 10 ms.

finish_measurement_only now ages the caches only when Renderer::changed
measured through the renderer since its last frame or the last call, so
a drag whose frames go to the worker still lets go of old node versions.
2026-12-02 16:44:10 -08:00
dotCooCoo 00b3d4ca06 3D: rendered mode keeps perspective depths close to the eye
The clip matrix refused a depth range whose depth slope came out
negative, which happens when the nearest point is close to the eye
(eye 100, depths 0 to 99.5), and the solid fell back to shaded faces.
The mapped depth rises between the two ends whenever w is positive at
both, so the check now tests w and the mapped depths instead of the
slope. A test covers that range and a range that reaches the eye.

The resolution test also checks that the rendered image carries its
pixels, and docs/mcp.md and docs/target-app-parity.md say that
rendered shadows need both Shading and Shadows on.
2026-12-02 02:11:55 -08:00
dotCooCoo c0d184b457 Merge main into feat/3d-rendered-tier 2026-12-02 00:28:46 -08:00
dotCooCoo f0dbad051c Tests: render and trace tests check what they claim
Weak tests in vectorcraft-render and vectorcraft-trace now assert the
behavior they name:

- The stroke glow test checks that the glow is drawn and that four
  threads draw what one does, instead of only rendering.
- The JPEG and palette id tests name saved ids and labels directly
  (gray, optimized, none, blackWhite), unknown and empty ids, instead
  of looping over every value and reading its own id back.
- The trace presets test drops the loop over every preset name, which
  presets().len() already covers, and checks the [Default] and padded
  name lookups by their result.
- Nested discs each get the disc below them as parent, checked exactly.
- A 20 degree bend gets no corner under a 30 degree minimum turn, and
  gets one under a 10 degree minimum.
- The gray BMP, reduced CMYK and tiled image tests check the size of
  what they read, and the long stroke tests check that one outline was
  made before checking that none is cropped.
- The three drag timing probes assert that the frame after the drag is
  what a fresh renderer draws, in place of printing two hashes.
2026-12-01 17:25:41 -08:00
.CooCoo 32dca73ec1 Merge pull request #10432 from dotCooCoo/fix/test-tolerances-render-effects-brush
Tests: exact expectations for gradients, brush pressure, Smart Blur and effects
2026-12-01 06:39:09 -08:00
.CooCoo 83b2c22b78 Merge pull request #10148 from dotCooCoo/feat/corner-marks
Arrange Tools: Mark Bounds of Each draws corner marks or a rectangle on each selected object's bounds
2026-12-01 06:18:27 -08:00
dotCooCoo 438ffdcebe Paste: a cut-short bitmap read off the UI thread gives way to its text
When a picture is read later in place of text that only names it, a raw
bitmap whose pixels don't fill the size in its header is not taken: the
text beside it is pasted, as for any picture that can't be read. A raw
bitmap with no text beside it is still read and its error reported.

read_pixels documents what happens when the renderers' store refuses
the decoded pixels: they are dropped, and the PNG is decoded as any
other image is. A render test covers that case.
2026-12-01 06:02:24 -08:00
e28faa0a94 Color Halftone: draw dark dots on light tones (#10316)
* fix(effects): draw dark dots in RGB Color Halftone

(cherry picked from commit 2dbe91af9f)

* Cover dark-on-light RGB halftone polarity

Updated halftone tests to clarify behavior regarding pixel brightness and dot sizes.

(cherry picked from commit babd60e332)

* effects: bound Color Halftone dots at full coverage

(cherry picked from commit 8fb0bf55607762df6e3acc2ed7ed37a643fea022)

* effects: describe Color Halftone ink coverage

(cherry picked from commit 0dbf12514095b6e12cb4414055d8ac47ee1fbcdc)

* Document the change to saved RGB halftones

* Test the bounded edge overlap of full halftone dots

---------

Co-authored-by: Mex <[email protected]>
Co-authored-by: dotCooCoo <[email protected]>
2026-12-01 14:17:04 +01:00
dotCooCoo e14ee70326 Tests: exact expectations for gradients, brush pressure, Smart Blur and effects
Seven render, brush and effects tests accepted results well away from
the value the code is meant to give:

- The two linear gradient tests now expect the value at the pixel
  center (126 of 255, red 126 and blue 129) within 2 levels, instead of
  12 or 20 around 128.
- The trimmed bristle strand test bounds the width ratio on both sides.
- The calligraphic roundness test expects the 0.1 pt hairline within
  1e-6 pt.
- Pucker & Bloat expects the corner anchor at (12.5, 12.5) and
  (-12.5, -12.5), not only the sign of the move.
- Exposure's offset and gamma checks expect the sRGB value within 1e-5.
- Smart Blur's checksums of earlier output are replaced by a 4 pixel row
  whose averages are worked out by hand.

Each new assertion fails when the code it covers is changed (the
gradient stops shifted, the pressure, roundness, pucker, offset or gamma
factor changed, or the blur threshold widened).
2026-12-01 01:53:59 -08:00
dotCooCoo f1ef1a4e39 Render: a thin stroke takes the corners of its own subpath
A corner in one subpath gave the stroke's join to the lines of a curve
in another subpath that met at the same point, so a miter could be
drawn there instead of a round join. The corners are now kept per
subpath and each subpath of the outline reads only its own.

Test: a curve's outline is the same with and without a second subpath
that has a corner at the curve's start.
2026-11-30 23:02:15 -08:00
dotCooCoo 69ff74a63b Render: thin strokes keep smooth curves round where their lines turn sharply
Since #9972 a thin stroke along a curve is drawn as lines, and where two
of those lines met at a sharp angle the stroke's own join was drawn
there. Along smooth anchors that sit close together after a bend, or a
curve that bends tightly, the lines turn sharply, so a miter join drew a
spike past the stroke and the smooth curve showed sharp corners on the
canvas. The document's anchors are unchanged; only the drawing was
wrong.

The stroke's join is now drawn only at the path's own corners, where
two segments meet with tangents that are not in line. Where the lines a
curve is drawn with turn sharply they meet with a round join, as the
stroke along the curve itself is round there.

Tests: a bend followed by smooth anchors 0.1 and 1 apart keeps every
outline point within the stroke's width of the curve and covers it;
with long handles the outline matches the curve's own outline away
from its edge; 200 random cubics with a miter join keep their outline
within the stroke's width of the curve.
2026-11-30 22:21:53 -08:00