#[non_exhaustive]pub enum Shape {
Rect {
width: f32,
height: f32,
fill: u32,
stroke: Option<Stroke>,
corner_radius: f32,
},
Polygon {
points: Vec<(f32, f32)>,
fill: u32,
stroke: Option<Stroke>,
},
Path {
data: String,
fill: u32,
stroke: Option<Stroke>,
},
}Expand description
Vector shape primitive.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl Shape
impl Shape
Sourcepub const fn rect(width: f32, height: f32) -> Self
pub const fn rect(width: f32, height: f32) -> Self
Zero-size placeholder rect with no fill. Used by
SceneObject::default.
Sourcepub fn content_size(&self) -> Option<(f32, f32)>
pub fn content_size(&self) -> Option<(f32, f32)>
Object-local content extent — the (width, height) of the
minimal axis-aligned box that contains the shape’s geometry
in its own coordinate system (before any Transform is
applied).
Shape::Rectreports its declared(width, height)verbatim. A rounded rect withcorner_radius > 0still has the same outer bound; the rounding only carves area away inside the box.Shape::Polygonreports the bounding box of itspointslist. An empty polygon reports(0.0, 0.0).Shape::Pathis parsed bycrate::svg_path::parse_bboxand reports the AABB of every anchor / control point. This is the convex-hull-of-control-points superset of the painted curve (an exact tight bound would walk the derivative roots); it is what scene-layer layout queries actually want. ReturnsNonefor empty / unparseable data.
Stroke half-widths are NOT included; the bounds reflect the
filled geometry only. A rasteriser that needs the stroked
silhouette must inflate the result by stroke.width / 2.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnsafeUnpin 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