#[repr(C, u8)]pub enum CssShape {
Circle(ShapeCircle),
Ellipse(ShapeEllipse),
Polygon(ShapePolygon),
Inset(ShapeInset),
Path(ShapePath),
}Expand description
Represents a CSS shape for shape-inside, shape-outside, and clip-path. Used for both text layout (shape-inside/outside) and rendering clipping (clip-path).
Variants§
Implementations§
Source§impl CssShape
impl CssShape
Sourcepub fn circle(center: ShapePoint, radius: f32) -> Self
pub fn circle(center: ShapePoint, radius: f32) -> Self
Creates a circle shape at the given position with the given radius
Sourcepub fn ellipse(center: ShapePoint, radius_x: f32, radius_y: f32) -> Self
pub fn ellipse(center: ShapePoint, radius_x: f32, radius_y: f32) -> Self
Creates an ellipse shape
Sourcepub fn polygon(points: ShapePointVec) -> Self
pub fn polygon(points: ShapePointVec) -> Self
Creates a polygon from a list of points
Source§impl CssShape
impl CssShape
Sourcepub fn bounding_box(&self) -> ShapeRect
pub fn bounding_box(&self) -> ShapeRect
Computes the bounding box of this shape
Sourcepub fn compute_line_segments(
&self,
y: f32,
margin: f32,
reference_box: OptionShapeRect,
) -> LineSegmentVec
pub fn compute_line_segments( &self, y: f32, margin: f32, reference_box: OptionShapeRect, ) -> LineSegmentVec
Computes available horizontal line segments at a given y-position. Used for text layout with shape-inside.
§Arguments
y- The vertical position to compute segments formargin- Inward margin from the shape boundaryreference_box- The containing box for inset shapes
§Returns
A vector of line segments, sorted by start_x
Trait Implementations§
Source§impl Ord for CssShape
impl Ord for CssShape
Source§impl PartialOrd for CssShape
impl PartialOrd for CssShape
impl Eq for CssShape
impl StructuralPartialEq for CssShape
Auto Trait Implementations§
impl Freeze for CssShape
impl RefUnwindSafe for CssShape
impl Send for CssShape
impl Sync for CssShape
impl Unpin for CssShape
impl UnwindSafe for CssShape
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