Incular logoIncular
API ReferenceLayout Widgets

ClipRect

Rectangular raster clip with configurable behavior.

ClipRect { clip_behavior: Clip, child: Widget } clips with a rectangular boundary. Default behavior HardEdge.

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(
                ClipRect::new(
                    Container::new()
                        .color(Color::WHITE)
                        .width(200.0)
                        .height(120.0),
                )
                .clip_behavior(Clip::AntiAlias),
            )
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}

Props

Prop

Type

Related: ClipRRect, Clip.

On this page