Skip to main content

Path

Struct Path 

Source
pub struct Path {
    pub fill_type: FillRule,
    /* private fields */
}
Expand description

A complex, one-dimensional subset of a plane: dart:ui’s Path.

Its contours are a valo path, built with a PathBuilder and shared, not copied, by every clone; its fill_type is what valo is handed with them wherever the path is filled, clipped to or hit tested. A call that passes as_valo to valo without the fill type fills the path with whatever rule it names instead.

Two paths are equal when their contours and fill types are, which is how a scene tells a clip that changed from one that did not.

Fields§

§fill_type: FillRule

Determines how the interior of this path is calculated.

Defaults to the non-zero winding rule, PathFillType::NonZero.

Implementations§

Source§

impl Path

Source

pub fn new(contours: Arc<Path>) -> Path

The path of contours, filled with the non-zero winding rule, as dart:ui’s Path() is.

Source

pub fn as_valo(&self) -> &Arc<Path> ⓘ

The contours, for valo’s calls, which take the fill type beside them.

Source

pub fn contains(&self, point: Offset) -> bool

Tests to see if the given point is within the path. (That is, whether the point would be in the visible portion of the path if the path was used with Canvas::clip_path.)

The point argument is interpreted as an offset from the origin.

Returns true if the point is in the path, and false otherwise.

Source

pub fn get_bounds(&self) -> Rect

Computes the bounding rectangle for this path.

A path containing only axis-aligned points on the same straight line will have no area, and therefore Rect::is_empty will return true for such a path.

Source

pub fn shift(&self, offset: Offset) -> Path

Returns a copy of the path with all the segments of every subpath translated by the given offset: Skia’s makeTransform by a translation, so a path built as a rounded rectangle or an oval stays one, and a shadow drawn from it keeps its closed form.

Source

pub fn transform(&self, matrix: &Matrix) -> Path

Returns a copy of the path with all the segments of every sub path transformed by the given matrix.

Trait Implementations§

Source§

impl Clone for Path

Source§

fn clone(&self) -> Path

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 CustomClipper<Path> for ShapeBorderClipper

Source§

fn get_clip(&self, _app: &App, size: Size) -> Path

Returns a description of the clip given that the render object being clipped is of the given size. Read more
Source§

fn should_reclip( &self, _app: &App, old_clipper: &(dyn CustomClipper<Path> + 'static), ) -> bool

Called whenever a new instance of the custom clipper delegate class is provided to the clip object, or any time that a new clip object is created with a new instance of the custom clipper delegate class (which amounts to the same thing, because the latter is implemented in terms of the former). Read more
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Downcast support for Dart’s runtimeType comparison and covariant parameter.
Source§

fn reclip(&self) -> Option<&Rc<dyn Listenable>>

The Listenable that notifies when it is time to reclip. Read more
Source§

fn get_approximate_clip_rect(&self, _app: &App, size: Size) -> Rect

Returns an approximation of the clip returned by get_clip, as an axis-aligned Rect. The widget inspector uses it to bound a screenshot of the clip’s subtree. Read more
Source§

impl Debug for Path

Source§

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

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

impl From<Arc<Path>> for Path

Source§

fn from(contours: Arc<Path>) -> Path

Converts to this type from the input type.
Source§

impl PartialEq for Path

Source§

fn eq(&self, other: &Path) -> 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 Path

Auto Trait Implementations§

§

impl Forget for Path

§

impl Freeze for Path
where *const ArcInner<Path> is !null: Freeze, PhantomData<ArcInner<Path>>: Freeze,

§

impl Move for Path

§

impl RefUnwindSafe for Path

§

impl Send for Path
where Arc<Path>: Send,

§

impl Sync for Path
where Arc<Path>: Sync,

§

impl Unpin for Path
where Arc<Path>: Unpin,

§

impl UnsafeUnpin for Path
where *const ArcInner<Path> is !null: UnsafeUnpin, PhantomData<ArcInner<Path>>: UnsafeUnpin,

§

impl UnwindSafe for Path

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,