Incular logoIncular
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.

EffectPurpose
GaussianBlurSymmetric or asymmetric blur sigmas
DropShadowEffectOffset shadow with blur and color
ColorFilterGrayscale, sepia, brightness, contrast, saturate, invert, opacity
EffectChainOrdered 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.

Related: Opacity, BlendMode.