DWF/DGN underlays: clipping, layers, text, 3D DGN, colours and zoom extents

- PDFOSNAP, DWFOSNAP and DGNOSNAP are separate; UOSNAP sets them all and
  reads 2 while they differ. Enable Snap switches the selected kind's.
- DWFCLIP / DGNCLIP clip their own kind with the kind's prompts and message;
  CLIP routes DWF and DGN underlays there; Enter at a corner asks again.
- The right-edge underlay tools show for DWF and DGN too (import is PDF
  only).
- Underlay layers: DGN levels (V8 level table, "Default" listed as "0"; V7
  used levels named from the level name table), hidden through the layer
  override data with the DGN placeholder string first; a plotted DWF has
  none.
- V8 colour read from its colour word (by level, index, or a true colour
  drawn as its nearest index); 3D V8 elements drawn in plan (lines, line
  strings, ellipses and arcs by their orientation, text); a model's extent
  includes its text.
- DWF 6 TrueType text (font, height, rotation from the font opcode) and DWFx
  glyph runs are drawn; the default W2D colour map is the measured one.
- Contrast pulls lightness towards a per-kind pivot as measured (PDF 0.5,
  DWF 0.243, DGN 0.65).
- Zoom extents includes raster images and underlays whose frames are hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-09-28 16:10:01 +03:00
1 parent 1cbe89ef62
commit 56ecf786f1
41 files changed
+593 -147

No files matched your search

+19 -5
View File
@@ -222,15 +222,24 @@ impl ImageModel {
};
(source, raster)
}
kind => (
def.file_path.clone(),
super::underlay_vector::display_raster(
kind => {
let hidden = super::pdf_layers::hidden_layers(u);
// The adjusted-pixel memo keys on the source: one per set of
// hidden layers.
let source = if hidden.is_empty() {
def.file_path.clone()
} else {
format!("{}#{}", def.file_path, hidden.join("|"))
};
let raster = super::underlay_vector::display_raster(
kind,
&def.file_path,
page,
&hidden,
screen_side.unwrap_or(super::underlay_vector::RASTER_SIDE),
)?,
),
)?;
(source, raster)
}
};
// Dark means an HSL lightness under one half: pure blue counts as
// light, (0, 128, 0) as dark.
@@ -243,6 +252,11 @@ impl ImageModel {
&raster,
PageAdjust {
contrast: u.contrast.min(100),
contrast_pivot: match def.underlay_type {
UnderlayType::Pdf => 500,
UnderlayType::Dwf => 243,
UnderlayType::Dgn => 650,
},
monochrome: u.flags.contains(UnderlayDisplayFlags::MONOCHROME),
adjust_for_background: u.flags.contains(UnderlayDisplayFlags::ADJUST_FOR_BACKGROUND),
// A DGN model is drawn for a black background, so its