pub(crate) enum Primitive {
RoundedRect {
rect: Rect,
radius: f32,
fill: Fill,
stroke: Option<Stroke>,
},
Ellipse {
center: Vec2,
radii: Vec2,
fill: Fill,
stroke: Option<Stroke>,
},
Line {
from: Vec2,
to: Vec2,
width: f32,
fill: Fill,
},
AnnularSector {
center: Vec2,
r_inner: f32,
r_outer: f32,
start_angle: f32,
end_angle: f32,
fill: Fill,
stroke: Option<Stroke>,
},
Polygon {
vertices: Vec<Vec2>,
fill: Fill,
},
}Expand description
One drawable primitive within a Graphics node.
Internal — the public API is Graphics::draw_*.
Variants§
RoundedRect
Axis-aligned rectangle. radius == 0.0 = sharp corners.
Ellipse
Axis-aligned ellipse defined by center and radii.
Line
Line segment rendered as a rotated rect of given width.
AnnularSector
Annular sector — pie slice (r_inner = 0), donut slice
(r_inner > 0), or stroked arc (r_outer - r_inner =
stroke band thickness).
Angles are radians; 0 aligns with +x, CCW positive.
start_angle < end_angle; angular span clamps to
[0, 2π]. When end - start ≥ 2π the primitive becomes a
full ring (or filled disc when r_inner = 0).
Fields
Polygon
Convex polygon defined by a vertex list in counter-clockwise winding order. The polygon is implicitly closed — the last vertex connects back to the first.
Convex-only for v1. Non-convex input is undefined behaviour today (fan triangulation produces visible overlap). Non-convex support deferred to a follow-on tessellator chunk.
No edge anti-aliasing in v1 — polygon edges show pixel
jaggies. Apply an outline stroke (separate draw_line
calls along the perimeter) when crisp edges matter; SDF
AA polish is a follow-on.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Primitive
impl RefUnwindSafe for Primitive
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnsafeUnpin for Primitive
impl UnwindSafe for Primitive
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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