pub struct XPathAdjust {
pub first_pt: usize,
pub last_pt: usize,
pub vert: bool,
pub x0a: f64,
pub x0b: f64,
pub x0: f64,
pub xma: f64,
pub xmb: f64,
pub xm: f64,
pub x1a: f64,
pub x1b: f64,
pub x1: f64,
}Expand description
An axis-aligned stroke-adjust hint, derived from a StrokeAdjustHint
(see crate::path::stroke) after path transformation.
Matches SplashXPathAdjust in splash/SplashXPath.cc.
§Snap-window fields
The three snap windows are open intervals; a coordinate v is replaced by
the target only when v ∈ (xa, xb) (strictly inside):
| Fields | Meaning |
|---|---|
x0a, x0b, x0 | Left snap window: coordinate in (x0a, x0b) snaps to x0. |
xma, xmb, xm | Mid snap window: coordinate in (xma, xmb) snaps to xm. |
x1a, x1b, x1 | Right snap window: coordinate in (x1a, x1b) snaps to x1. |
Fields§
§first_pt: usizeFirst path-point index (inclusive) in the range to adjust.
last_pt: usizeLast path-point index (inclusive) in the range to adjust.
vert: booltrue → adjust the x-coordinate; false → adjust the y-coordinate.
x0a: f64Left snap window lower bound (adj0 - 0.01).
x0b: f64Left snap window upper bound (adj0 + 0.01).
x0: f64Left snap target (rounded adj0).
xma: f64Mid snap window lower bound (mid - 0.01).
xmb: f64Mid snap window upper bound (mid + 0.01).
xm: f64Mid snap target (midpoint of rounded endpoints).
x1a: f64Right snap window lower bound (adj1 - 0.01).
x1b: f64Right snap window upper bound (adj1 + 0.01).
x1: f64Right snap target (rounded_adj1 - 0.01).
Implementations§
Source§impl XPathAdjust
impl XPathAdjust
Sourcepub fn new(
first_pt: usize,
last_pt: usize,
vert: bool,
adj0: f64,
adj1: f64,
adjust_lines: bool,
line_pos_i: i32,
) -> Self
pub fn new( first_pt: usize, last_pt: usize, vert: bool, adj0: f64, adj1: f64, adjust_lines: bool, line_pos_i: i32, ) -> Self
Construct an adjust record for two endpoint values adj0 ≤ adj1.
§Precondition
adj0 <= adj1. The caller in build_adjusts in xpath.rs guarantees
this by passing min/max-reduced values.
adjust_lines and line_pos_i implement the same special-case logic as
in SplashXPath constructor: when the two rounded endpoints coincide and
adjust_lines is true, the span is expanded to
[line_pos_i, line_pos_i + 1].
Trait Implementations§
Source§impl Clone for XPathAdjust
impl Clone for XPathAdjust
Source§fn clone(&self) -> XPathAdjust
fn clone(&self) -> XPathAdjust
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more