API ReferenceLayout Values
Clip
Clipping behavior with cost and quality trade-offs.
use incular::config::Clip;
fn main() {
let clips = [
Clip::None,
Clip::HardEdge,
Clip::AntiAlias,
Clip::AntiAliasWithSaveLayer,
];
println!("clips: {}", clips.len());
}| Variant | Cost | Effect |
|---|---|---|
None | Zero | Overflow paints |
HardEdge | Cheap | Fast rectangular clip (default) |
AntiAlias | Medium | Smooth edges |
AntiAliasWithSaveLayer | High | Smooth + isolated layer |
StackFit: Loose (default) / Expand / Passthrough.
None lets overflow paint; HardEdge is the fast rectangular clip;
AntiAlias smooths edges; AntiAliasWithSaveLayer adds an isolated layer at
higher cost. StackFit: Loose (default) / Expand / Passthrough.
use incular::prelude::*;
use incular::config::Clip;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let app = Application::new(|_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
Container::new()
.color(Color::WHITE)
.radius(24.0)
.clip_behavior(Clip::AntiAlias)
.width(160.0)
.height(160.0)
.child(Text::new("Clipped")),
)
.build()
.into()
})?;
incular::run(app)?;
Ok(())
}