mirror of
https://github.com/storytold/cadcraft.git
synced 2026-11-03 08:52:05 -06:00
* chore(clippy): enforce workspace Rust quality gates * refactor(doc): use explicit entity imports * refactor(constraints): split residual evaluation * refactor(fonts): split mtext layout * refactor(render): use explicit entity imports * fix(fonts): retain height for empty paragraphs * fix(doc): repair dimension and dynamic block links * refactor(render): split entity drawing helpers * docs: document workspace lint inheritance * refactor(render): isolate dimension geometry * refactor(engine): use explicit imports * refactor(engine): split complex edit paths into helpers * refactor(io): split DXF read and write helpers * refactor(ui): split canvas interaction and drawing * refactor(ui): split command and drawing helpers * test(i18n): split locale preference checks * fix(ui): use current egui scope id API * fix(dim): preserve text offset and ellipse grip behavior
62 lines
1.9 KiB
Rust
62 lines
1.9 KiB
Rust
use super::common::Handle;
|
|
use super::{Color, Deserialize, PolyVertex, Serialize, Vec2, one};
|
|
|
|
/// A hatch boundary loop: closed polyline with bulges.
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct HatchLoop {
|
|
pub vertices: Vec<PolyVertex>,
|
|
#[serde(default)]
|
|
pub outer: bool,
|
|
/// The objects the loop was made from (DXF group 97 count, 330 handles): an associative
|
|
/// hatch re-fills the loop from them when they change.
|
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
|
pub sources: Vec<Handle>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Hatch {
|
|
pub pattern: String,
|
|
pub solid: bool,
|
|
pub loops: Vec<HatchLoop>,
|
|
#[serde(default = "one")]
|
|
pub scale: f64,
|
|
#[serde(default)]
|
|
pub angle: f64,
|
|
#[serde(default)]
|
|
pub associative: bool,
|
|
/// 0 normal (odd parity), 1 outer, 2 ignore.
|
|
#[serde(default)]
|
|
pub style: u8,
|
|
#[serde(default)]
|
|
pub elevation: f64,
|
|
/// Gradient fill: name + second colour.
|
|
#[serde(default)]
|
|
pub gradient: Option<Gradient>,
|
|
#[serde(default)]
|
|
pub origin: Vec2,
|
|
#[serde(default)]
|
|
pub background: Option<Color>,
|
|
/// The pattern's line families as a file defined them, for a pattern that isn't in the
|
|
/// standard library (unit scale and angle, like the library's; empty otherwise).
|
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
|
pub pattern_lines: Vec<crate::library::PatternLine>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Gradient {
|
|
pub name: String,
|
|
pub color1: Color,
|
|
pub color2: Color,
|
|
#[serde(default)]
|
|
pub angle: f64,
|
|
#[serde(default)]
|
|
pub centered: bool,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct Wipeout {
|
|
pub boundary: Vec<Vec2>,
|
|
}
|