pub struct PathShape {
pub points: Vec<Pos2>,
pub closed: bool,
pub fill: Color32,
pub stroke: PathStroke,
}
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: PathStroke
Color and thickness of the line.
Implementations§
source§impl PathShape
impl PathShape
sourcepub fn line(points: Vec<Pos2>, stroke: impl Into<PathStroke>) -> Self
pub fn line(points: Vec<Pos2>, stroke: impl Into<PathStroke>) -> Self
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<PathStroke>) -> Self
pub fn closed_line(points: Vec<Pos2>, stroke: impl Into<PathStroke>) -> Self
A line that closes back to the start point again.
sourcepub fn convex_polygon(
points: Vec<Pos2>,
fill: impl Into<Color32>,
stroke: impl Into<PathStroke>,
) -> Self
pub fn convex_polygon( points: Vec<Pos2>, fill: impl Into<Color32>, stroke: impl Into<PathStroke>, ) -> Self
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§
source§impl<'de> Deserialize<'de> for PathShape
impl<'de> Deserialize<'de> for PathShape
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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 more