pub enum Shape {
Noop,
Vec(Vec<Shape>),
Circle {
center: Pos2,
radius: f32,
fill: Color32,
stroke: Stroke,
},
LineSegment {
points: [Pos2; 2],
stroke: Stroke,
},
Path {
points: Vec<Pos2>,
closed: bool,
fill: Color32,
stroke: Stroke,
},
Rect {
rect: Rect,
corner_radius: f32,
fill: Color32,
stroke: Stroke,
},
Text {
pos: Pos2,
galley: Arc<Galley>,
color: Color32,
fake_italics: bool,
},
Mesh(Mesh),
}Expand description
A paint primitive such as a circle or a piece of text. Coordinates are all screen space points (not physical pixels).
Variants§
Noop
Paint nothing. This can be useful as a placeholder.
Vec(Vec<Shape>)
Recursively nest more shapes - sometimes a convenience to be able to do. For performance reasons it is better to avoid it.
Circle
LineSegment
Path
Fields
Rect
Fields
Text
Fields
Mesh(Mesh)
Implementations§
Source§impl Shape
§Constructors
impl Shape
§Constructors
Sourcepub fn line_segment(points: [Pos2; 2], stroke: impl Into<Stroke>) -> Shape
pub fn line_segment(points: [Pos2; 2], stroke: impl Into<Stroke>) -> Shape
A line between two points.
More efficient than calling Self::line.
Sourcepub fn line(points: Vec<Pos2>, stroke: impl Into<Stroke>) -> Shape
pub fn line(points: Vec<Pos2>, stroke: impl Into<Stroke>) -> Shape
A line through many points.
Use Self::line_segment instead if your line only connects two points.
Sourcepub fn closed_line(points: Vec<Pos2>, stroke: impl Into<Stroke>) -> Shape
pub fn closed_line(points: Vec<Pos2>, stroke: impl Into<Stroke>) -> Shape
A line that closes back to the start point again.
Sourcepub fn dotted_line(
points: &[Pos2],
color: impl Into<Color32>,
spacing: f32,
radius: f32,
) -> Vec<Shape>
pub fn dotted_line( points: &[Pos2], color: impl Into<Color32>, spacing: f32, radius: f32, ) -> Vec<Shape>
Turn a line into equally spaced dots.
Sourcepub fn dashed_line(
points: &[Pos2],
stroke: impl Into<Stroke>,
dash_length: f32,
gap_length: f32,
) -> Vec<Shape>
pub fn dashed_line( points: &[Pos2], stroke: impl Into<Stroke>, dash_length: f32, gap_length: f32, ) -> Vec<Shape>
Turn a line into dashes.
Sourcepub fn convex_polygon(
points: Vec<Pos2>,
fill: impl Into<Color32>,
stroke: impl Into<Stroke>,
) -> Shape
pub fn convex_polygon( points: Vec<Pos2>, fill: impl Into<Color32>, stroke: impl Into<Stroke>, ) -> Shape
A convex polygon with a fill and optional stroke.
pub fn polygon( points: Vec<Pos2>, fill: impl Into<Color32>, stroke: impl Into<Stroke>, ) -> Shape
👎Deprecated: Renamed convex_polygon
pub fn circle_filled( center: Pos2, radius: f32, fill_color: impl Into<Color32>, ) -> Shape
pub fn circle_stroke( center: Pos2, radius: f32, stroke: impl Into<Stroke>, ) -> Shape
pub fn rect_filled( rect: Rect, corner_radius: f32, fill_color: impl Into<Color32>, ) -> Shape
pub fn rect_stroke( rect: Rect, corner_radius: f32, stroke: impl Into<Stroke>, ) -> Shape
pub fn text( fonts: &Fonts, pos: Pos2, anchor: Align2, text: impl ToString, text_style: TextStyle, color: Color32, ) -> Shape
Trait Implementations§
impl StructuralPartialEq for Shape
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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