API ReferenceLayout Widgets
ClipPath
Arbitrary path clip with non-zero fill rule.
ClipPath { path: Arc<Path>, clip_behavior: Clip, child: Widget } clips with
an arbitrary Path (non-zero fill). Default behavior
AntiAlias.
use incular::prelude::*;
use std::sync::Arc;
fn star() -> Arc<Path> {
let mut b = Path::builder();
b.move_to(Offset::new(50.0, 0.0));
b.line_to(Offset::new(100.0, 100.0));
b.line_to(Offset::new(0.0, 100.0));
b.close();
Arc::new(b.build())
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let app = Application::new(|_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
ClipPath::new(
star(),
Container::new()
.color(Color::WHITE)
.width(120.0)
.height(120.0),
),
)
.build()
.into()
})?;
incular::run(app)?;
Ok(())
}Props
Prop
Type