Skip to main content

XPathAdjust

Struct XPathAdjust 

Source
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):

FieldsMeaning
x0a, x0b, x0Left snap window: coordinate in (x0a, x0b) snaps to x0.
xma, xmb, xmMid snap window: coordinate in (xma, xmb) snaps to xm.
x1a, x1b, x1Right snap window: coordinate in (x1a, x1b) snaps to x1.

Fields§

§first_pt: usize

First path-point index (inclusive) in the range to adjust.

§last_pt: usize

Last path-point index (inclusive) in the range to adjust.

§vert: bool

true → adjust the x-coordinate; false → adjust the y-coordinate.

§x0a: f64

Left snap window lower bound (adj0 - 0.01).

§x0b: f64

Left snap window upper bound (adj0 + 0.01).

§x0: f64

Left snap target (rounded adj0).

§xma: f64

Mid snap window lower bound (mid - 0.01).

§xmb: f64

Mid snap window upper bound (mid + 0.01).

§xm: f64

Mid snap target (midpoint of rounded endpoints).

§x1a: f64

Right snap window lower bound (adj1 - 0.01).

§x1b: f64

Right snap window upper bound (adj1 + 0.01).

§x1: f64

Right snap target (rounded_adj1 - 0.01).

Implementations§

Source§

impl XPathAdjust

Source

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

Source§

fn clone(&self) -> XPathAdjust

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for XPathAdjust

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.