Seregon/StratoSDK

StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.

Rust/27.3 KB/No license
crates/strato-ui-renderer/examples/blur/root_view.rs
1use pathfinder_color::ColorU;
2use strato_ui::{elements::Rect, AppContext, Element, Entity, TypedActionView, View};
3 
4pub struct BlurredView {}
5 
6impl Entity for BlurredView {
7 type Event = ();
8}
9impl View for BlurredView {
10 fn ui_name() -> &'static str {
11 "RootView"
12 }
13 
14 /// Renders a transparent red rectangle. The blur effect is applied on the window (see
15 /// `open_new()`.
16 fn render(&self, _: &AppContext) -> Box<dyn Element> {
17 Rect::new()
18 .with_background_color(ColorU::new(255, 0, 0, 50))
19 .finish()
20 }
21}
22 
23impl TypedActionView for BlurredView {
24 type Action = ();
25}
26