pub struct PathShape {
pub points: Vec<Pos2>,
pub closed: bool,
pub fill: Color32,
pub stroke: Stroke,
}
Expand description
A path which can be stroked and/or filled (if closed).
Fields§
§points: Vec<Pos2>
Filled paths should prefer clockwise order.
closed: bool
If true, connect the first and last of the points together.
This is required if fill != TRANSPARENT
.
fill: Color32
Fill is only supported for convex polygons.
stroke: Stroke
Color and thickness of the line.
Implementations§
Source§impl PathShape
impl PathShape
Sourcepub fn line(points: Vec<Pos2>, stroke: impl Into<Stroke>) -> PathShape
pub fn line(points: Vec<Pos2>, stroke: impl Into<Stroke>) -> PathShape
A line through many points.
Use Shape::line_segment
instead if your line only connects two points.
Sourcepub fn closed_line(points: Vec<Pos2>, stroke: impl Into<Stroke>) -> PathShape
pub fn closed_line(points: Vec<Pos2>, stroke: impl Into<Stroke>) -> PathShape
A line that closes back to the start point again.
Sourcepub fn convex_polygon(
points: Vec<Pos2>,
fill: impl Into<Color32>,
stroke: impl Into<Stroke>,
) -> PathShape
pub fn convex_polygon( points: Vec<Pos2>, fill: impl Into<Color32>, stroke: impl Into<Stroke>, ) -> PathShape
A convex polygon with a fill and optional stroke.
The most performant winding order is clockwise.
Sourcepub fn visual_bounding_rect(&self) -> Rect
pub fn visual_bounding_rect(&self) -> Rect
The visual bounding rectangle (includes stroke width)
Trait Implementations§
impl StructuralPartialEq for PathShape
Auto Trait Implementations§
impl Freeze for PathShape
impl RefUnwindSafe for PathShape
impl Send for PathShape
impl Sync for PathShape
impl Unpin for PathShape
impl UnwindSafe for PathShape
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.