PDF follow-ups: import layers, arcs and joins, names, background, page placement, snaps

- Unlayered raster images go with the PDF layer drawn last before them.
- Circular Bezier arcs import as arcs: bulged polyline segments with Join,
  ARC entities without it; straight chains still join.
- Imported PNGs go to "PDF Images" next to the PDF; import blocks are
  numbered imp31, imp32, ...
- Background darkness is its HSL lightness below one half.
- All chosen pages attach at the same insertion point.
- PDF geometry snaps as separate pieces: centre from the rim, intersections
  and perpendiculars.
- Automation: snap query with an optional base point.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-09-25 10:33:48 +03:00
1 parent 857f2f2e58
commit edbbc9d135
10 files changed
+347 -63

No files matched your search

+6 -2
View File
@@ -217,7 +217,11 @@ impl ImageModel {
// Hidden PDF layers come from the underlay's layer overrides.
let source = super::pdf_layers::underlay_source(u, &def.file_path);
let raster = pdf_raster::rasterize_page_display(&source, page)?;
let bg_lum = 0.299 * background[0] + 0.587 * background[1] + 0.114 * background[2];
// Dark means an HSL lightness under one half: pure blue counts as
// light, (0, 128, 0) as dark.
let bg_max = background[0].max(background[1]).max(background[2]);
let bg_min = background[0].min(background[1]).min(background[2]);
let bg_lum = (bg_max + bg_min) / 2.0;
let pixels = pdf_raster::adjusted_pixels(
&source,
page,
@@ -226,7 +230,7 @@ impl ImageModel {
contrast: u.contrast.min(100),
monochrome: u.flags.contains(UnderlayDisplayFlags::MONOCHROME),
adjust_for_background: u.flags.contains(UnderlayDisplayFlags::ADJUST_FOR_BACKGROUND),
dark_background: bg_lum <= 0.5,
dark_background: bg_lum < 0.5,
},
);