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

+12 -7
View File
@@ -1,4 +1,4 @@
//! Selection-driven tools: while only PDF underlays (or only xrefs) are
//! Selection-driven tools: while only underlays of one kind (or only xrefs) are
//! selected their actions show on the right-edge toolbar; they go when the
//! selection changes. Contrast and fade stay in the Properties panel.
@@ -9,6 +9,7 @@ use crate::modules::{ModuleEvent, ToolDef};
/// as on.
#[derive(Clone, Debug, PartialEq)]
pub struct UnderlayContext {
pub kind: codec::entities::UnderlayType,
pub monochrome: bool,
pub shown: bool,
pub snap: bool,
@@ -27,10 +28,11 @@ const CLIP: &[u8] = include_bytes!("../../../assets/icons/xclip.svg");
/// The clip icon with a small red cross at its lower right.
const UNCLIP: &[u8] = include_bytes!("../../../assets/icons/xclip_remove.svg");
/// PDF underlay tools: display, clipping, options, layers and import.
pub fn pdf_underlay_tools() -> Vec<ToolDef> {
/// Underlay tools: display, clipping, options, layers and (PDF only)
/// import.
pub fn pdf_underlay_tools(kind: codec::entities::UnderlayType) -> Vec<ToolDef> {
const FRAMES: &[u8] = include_bytes!("../../../assets/icons/underlay_frames.svg");
vec![
let mut tools = vec![
tool("_PDFULMONO", "Display in\nMonochrome", FRAMES),
tool("_PDFULCLIP", "Create Clipping\nBoundary", CLIP),
tool("_PDFULUNCLIP", "Remove\nClipping", UNCLIP),
@@ -46,12 +48,15 @@ pub fn pdf_underlay_tools() -> Vec<ToolDef> {
"Edit\nLayers",
include_bytes!("../../../assets/icons/underlay_layers.svg"),
),
tool(
];
if kind == codec::entities::UnderlayType::Pdf {
tools.push(tool(
"_PDFULIMPORT",
"Import As\nObjects",
include_bytes!("../../../assets/icons/cui_import.svg"),
),
]
));
}
tools
}
/// External reference tools: edit, open, clipping and the palette.
+1 -1
View File
@@ -679,7 +679,7 @@ pub fn view_layers<'a>(
.height(Fill)
.into()
}
_ => container(text(t!("This file does not contain any layers.")).size(11).style(muted_style))
_ => container(text(t!("This file does not contain any layers")).size(11).style(muted_style))
.width(Fill)
.height(Fill)
.align_x(iced::Center)