API ReferencePainting & Animation
Effects
Blur, drop shadows, color matrices, and effect chains.
use incular::prelude::*;
fn main() {
let gray = ColorFilter::grayscale(1.0);
println!("identity: {}", gray.is_identity());
let app = Application::new(|_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
Opacity::new(0.85, Text::new("Filtered"))
)
.build()
.into()
})
.expect("valid application");
incular::run(app).expect("run application");
}ColorFilter is a 20-float matrix. Helpers: normalize_sigma,
blur_margin, blur_bounds, drop_shadow_bounds,
gaussian_kernel_weights.
| Effect | Purpose |
|---|---|
GaussianBlur | Symmetric or asymmetric blur sigmas |
DropShadowEffect | Offset shadow with blur and color |
ColorFilter | Grayscale, sepia, brightness, contrast, saturate, invert, opacity |
EffectChain | Ordered composition of filters and blurs |
ColorFiltered { filter, controller?, child } is the declarative 4×5
straight-RGBA stage (new, controlled, matrix([f32; 20]), filter(),
controller()); ColorMatrix aliases ColorFilter.