Skip to main content

Shape

Struct Shape 

Source
pub struct Shape { /* private fields */ }
Expand description

Multipolygon ink / halo geometry.

Implementations§

Source§

impl Shape

Source

pub fn empty() -> Self

Source

pub fn is_empty(&self) -> bool

Source

pub fn from_ring(ring: &[(f64, f64)]) -> Self

Single exterior ring (lib-simplify cleans winding / collinear).

Source

pub fn from_contours_evenodd(contours: &[Vec<(f64, f64)>]) -> Self

Independent contours → even-odd / XOR shape (glyph counters).

Source

pub fn disk(cx: f64, cy: f64, radius: f64, quad_segs: u32) -> Self

Source

pub fn capsule(x1: f64, y1: f64, x2: f64, y2: f64, radius: f64) -> Self

Source

pub fn polyline_buffer(pts: &[(f64, f64)], radius: f64) -> Self

Source

pub fn multipoint_buffer(pts: &[(f64, f64)], radius: f64) -> Self

Source

pub fn annular(cx: f64, cy: f64, r: f64, stroke_width: f64) -> Self

Source

pub fn union(&self, other: &Self) -> Self

Source

pub fn difference(&self, other: &Self) -> Self

Source

pub fn xor(&self, other: &Self) -> Self

Source

pub fn buffer(&self, dist: f64) -> Self

Outline offset (dist may be negative).

Source

pub fn simplify(&self) -> Self

i_overlay::SimplifyShape (collinear cleanup; holes stay valid).

Source

pub fn point_count(&self) -> usize

Source

pub fn halo(&self, dist: f64) -> Self

White knockout: simplify, then outline offset.

Source

pub fn has_holes(&self) -> bool

Source

pub fn translate(&self, dx: f64, dy: f64) -> Self

Source

pub fn scale(&self, sx: f64, sy: f64, ox: f64, oy: f64) -> Self

Source

pub fn bounds(&self) -> Option<(f64, f64, f64, f64)>

Source

pub fn area(&self) -> f64

Source

pub fn centroid(&self) -> Option<(f64, f64)>

Source

pub fn contains(&self, x: f64, y: f64) -> bool

Source

pub fn to_svg_d(&self) -> String

Source

pub fn horizontal_span_at(&self, y: f64) -> f64

Leftmost horizontal chord length at y (stem-width helper).

Source

pub fn polygons_rings(&self) -> Vec<(Vec<(f64, f64)>, Vec<Vec<(f64, f64)>>)>

Trait Implementations§

Source§

impl Clone for Shape

Source§

fn clone(&self) -> Shape

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 Shape

Source§

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

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

impl Default for Shape

Source§

fn default() -> Shape

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Shape

§

impl RefUnwindSafe for Shape

§

impl Send for Shape

§

impl Sync for Shape

§

impl Unpin for Shape

§

impl UnsafeUnpin for Shape

§

impl UnwindSafe for Shape

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.