#[non_exhaustive]pub enum VectorShape {
Rect {
rect: Rect,
},
RoundedRect {
rect: Rect,
radius: f32,
},
Circle {
center: Vec2,
radius: f32,
},
Ellipse {
center: Vec2,
half_extents: Vec2,
},
Path {
points: Vec<Vec2>,
},
}Expand description
Geometric shape — no paint, no transform. The “what” of a vector primitive.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Rect
Sharp-corner rectangle in NDC.
RoundedRect
Rounded rectangle in NDC.
Circle
Circle in NDC.
Ellipse
Anisotropic ellipse in NDC.
Fields
Path
Closed polygon in NDC. Up to 32 vertices honored by the mask
path (matching path_clip.wgsl’s uniform cap).
Implementations§
Source§impl VectorShape
impl VectorShape
Sourcepub fn rounded_rect(rect: Rect, radius: f32) -> Self
pub fn rounded_rect(rect: Rect, radius: f32) -> Self
Convenience constructor.
Sourcepub fn bounds(&self) -> Rect
pub fn bounds(&self) -> Rect
Axis-aligned bounding rect of the shape. For paths, computed from the point list (returns a zero rect for an empty path).
Sourcepub fn as_mask_shape(&self) -> Option<MaskShape>
pub fn as_mask_shape(&self) -> Option<MaskShape>
If this shape has an analytic SDF (rect / rounded / circle /
ellipse), return it as a MaskShape so the existing mask /
clip / privacy-blur / redaction / spotlight machinery can
consume it directly. Returns None for Self::Path —
callers should use the path-clip / path-mask-texture variants
instead.
Sourcepub fn as_path_points(&self) -> Option<&[Vec2]>
pub fn as_path_points(&self) -> Option<&[Vec2]>
If this is a path, return the points slice. Returns None
for analytic SDF shapes.
Trait Implementations§
Source§impl Clone for VectorShape
impl Clone for VectorShape
Source§fn clone(&self) -> VectorShape
fn clone(&self) -> VectorShape
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VectorShape
impl Debug for VectorShape
Source§impl PartialEq for VectorShape
impl PartialEq for VectorShape
Source§fn eq(&self, other: &VectorShape) -> bool
fn eq(&self, other: &VectorShape) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for VectorShape
Auto Trait Implementations§
impl Freeze for VectorShape
impl RefUnwindSafe for VectorShape
impl Send for VectorShape
impl Sync for VectorShape
impl Unpin for VectorShape
impl UnsafeUnpin for VectorShape
impl UnwindSafe for VectorShape
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