Skip to main content

Geometry

Struct Geometry 

Source
pub struct Geometry {
    pub view: ViewBox,
    pub paths: Vec<SubPath>,
}
Expand description

A custom shape’s outline.

Fields§

§view: ViewBox

The space the points are in.

§paths: Vec<SubPath>

The strokes, in the order they are drawn.

Implementations§

Source§

impl Geometry

Source

pub fn read_path(path: &Element) -> Option<Self>

Read a draw:path element, whose outline is SVG path data in svg:d.

None where it states no path or no coordinate space.

Arcs are drawn as the straight line to where they end. A and a occur in none of the 352 paths across the presentation templates LibreOffice ships, and turning an endpoint-parameterised elliptical arc into a centre and a sweep is a page of trigonometry to serve nothing that exists. A line keeps the outline closed and roughly where it belongs, which is the failure worth having.

Source

pub fn refit(&mut self)

Refit the view box to the outline inside it.

A draw:connector is the shape that needs this. Its route is written in the page’s own coordinates while the svg:viewBox beside it states an origin of zero, so the two do not agree and the declared box places the points nowhere near the shape. The outline’s own bounding box does place them, and for a shape whose box was already right it says the same thing.

An outline with no width or no height keeps a box one unit across, so that a straight horizontal connector divides by something.

Source

pub fn read(geometry: &Element) -> Option<Self>

Read a draw:enhanced-geometry element.

None where it states no path or no coordinate space, which is a shape nothing can draw.

Trait Implementations§

Source§

impl Clone for Geometry

Source§

fn clone(&self) -> Self

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 Geometry

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Geometry

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Geometry

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.