1use super::*;
2
3pub(crate) fn render_mode_name(idx: usize) -> &'static str {
13 match idx {
14 1 => MODE_SOFTWARE,
15 2 => MODE_HARDWARE,
16 3 => MODE_HYBRID,
17 _ => MODE_AUTO,
18 }
19}
20
21pub(crate) fn render_blur_radius(idx: usize) -> f32 {
31 match idx {
32 0 => 8.0,
33 2 => 24.0,
34 _ => 16.0,
35 }
36}
37
38pub(crate) fn render_gradient_angle(idx: usize) -> f32 {
48 match idx {
49 0 => 0.0,
50 2 => 90.0,
51 3 => 135.0,
52 _ => 45.0,
53 }
54}
55
56pub(crate) fn mount_render_vector_card(
67 mode_idx: Signal<usize>,
68 tokens: ThemeTokens,
69) -> (NodeId, NodeId) {
70 let p: ThemePalette = tokens.get_palette();
71 let g: ThemeGeometry = tokens.get_geometry();
72 let mut canvas_id: NodeId = NodeId::default();
73 let pipeline_label = move || -> String {
74 let mode_name: &str = render_mode_name(mode_idx.get());
75 format!("Demo Preview Pipeline: {mode_name} (Widget-Scoped — Global App Unchanged)")
76 };
77 let paint_preview = move |bounds: Rect, dl: &mut DisplayList| {
78 let live: ThemeTokens = live_tokens_untracked(tokens);
79 let lp: ThemePalette = live.get_palette();
80 let mode: usize = mode_idx.get_untracked();
81 let bw: f32 = bounds.get_width().max(120.0);
82 let bh: f32 = bounds.get_height().max(100.0);
83 let grid_col: Color = lp.get_border().with_alpha(90);
84 let step_x: f32 = (bw / 6.0).max(32.0);
85 let mut gx: f32 = bounds.get_x() + step_x;
86 while gx < bounds.right() - 8.0 {
87 dl.push(DrawCommand::Line {
88 from: Point::new(gx, bounds.get_y() + 8.0),
89 to: Point::new(gx, bounds.bottom() - 8.0),
90 color: grid_col,
91 width: 1.0,
92 });
93 gx += step_x;
94 }
95 let rect_w: f32 = (bw * 0.28).clamp(64.0, 210.0);
96 let rect_h: f32 = (bh - 52.0).max(60.0);
97 let primary_fill: Color = match mode {
98 1 => lp.get_secondary(),
99 2 => lp.get_primary(),
100 3 => lp.get_success(),
101 _ => lp.get_primary(),
102 };
103 dl.push(DrawCommand::FillRoundedRect {
104 rect: Rect::new(bounds.get_x() + 18.0, bounds.get_y() + 34.0, rect_w, rect_h),
105 color: primary_fill,
106 radius: CornerRadius::all(14.0),
107 border: Border::new(1.5, lp.get_border()),
108 });
109 let circle_r: f32 = (bw * 0.085).clamp(22.0, 48.0);
110 let circle_x: f32 = (bounds.get_x() + 18.0 + rect_w + circle_r + 24.0)
111 .min(bounds.right() - circle_r - 14.0);
112 let circle_y: f32 = bounds.get_y() + 34.0 + rect_h * 0.5;
113 dl.push(DrawCommand::Circle {
114 center: Point::new(circle_x, circle_y),
115 radius: circle_r + 6.0,
116 color: lp.get_success().with_alpha(52),
117 });
118 dl.push(DrawCommand::Circle {
119 center: Point::new(circle_x, circle_y),
120 radius: circle_r,
121 color: lp.get_success(),
122 });
123 let line_x0: f32 = (circle_x + circle_r + 18.0).min(bounds.right() - 24.0);
124 let line_x1: f32 = (bounds.right() - 18.0).max(line_x0);
125 dl.push(DrawCommand::Line {
126 from: Point::new(line_x0, bounds.get_y() + 42.0),
127 to: Point::new(line_x1, bounds.bottom() - 22.0),
128 color: lp.get_warning(),
129 width: 3.5,
130 });
131 dl.push(DrawCommand::Line {
132 from: Point::new(line_x0, bounds.bottom() - 22.0),
133 to: Point::new(line_x1, bounds.get_y() + 42.0),
134 color: lp.get_primary().with_alpha(180),
135 width: 2.0,
136 });
137 let mut hud_style: TextStyle = TextStyle::default();
138 hud_style
139 .set_font_size(11.5)
140 .set_weight(FontWeight::SemiBold)
141 .set_color(lp.get_foreground());
142 dl.push(DrawCommand::TextRun {
143 rect: Rect::new(
144 bounds.get_x() + 16.0,
145 bounds.get_y() + 10.0,
146 (bw - 32.0).max(1.0),
147 18.0,
148 ),
149 text: format!(
150 "SDF Vector Stage | Preview Mode: {} | Bounds: {:.0}x{:.0}",
151 render_mode_name(mode),
152 bw,
153 bh
154 ),
155 style: hud_style,
156 });
157 };
158 let card: NodeId = view! {
159 EuvCard {
160 title: RENDER_CARD_TITLE.to_string()
161 tokens: tokens
162 subtitle: RENDER_CARD_SUB
163 column {
164 style: {
165 width: Length::Percent(100.0)
166 gap: SPACE_SM
167 }
168 text {
169 style: {
170 width: Length::Percent(100.0)
171 font_size: 13.0
172 font_weight: FontWeight::SemiBold
173 color: p.get_primary()
174 }
175 { pipeline_label }
176 }
177 text {
178 style: {
179 width: Length::Percent(100.0)
180 font_size: 12.0
181 font_weight: FontWeight::Medium
182 color: p.get_muted_foreground()
183 }
184 { CANVAS_LABEL }
185 }
186 canvas {
187 node_ref: canvas_id
188 style: {
189 width: Length::Percent(100.0)
190 height: Length::Px(RENDER_VECTOR_CANVAS_HEIGHT)
191 background: p.get_muted()
192 border: (g.get_border_width(), p.get_border())
193 radius: g.get_radius_md()
194 }
195 painter: paint_preview
196 }
197 }
198 }
199 };
200 (card, canvas_id)
201}
202
203pub(crate) fn mount_render_blur_card(
214 blur_idx: Signal<usize>,
215 tokens: ThemeTokens,
216) -> (NodeId, NodeId) {
217 let p: ThemePalette = tokens.get_palette();
218 let g: ThemeGeometry = tokens.get_geometry();
219 let mut glass_id: NodeId = NodeId::default();
220 let paint_backdrop = move |bounds: Rect, dl: &mut DisplayList| {
221 let live: ThemeTokens = live_tokens_untracked(tokens);
222 let lp: ThemePalette = live.get_palette();
223 let bw: f32 = bounds.get_width().max(80.0);
224 let bh: f32 = bounds.get_height().max(80.0);
225 dl.push(DrawCommand::Circle {
226 center: Point::new(bounds.get_x() + bw * 0.24, bounds.get_y() + bh * 0.48),
227 radius: (bh * 0.34).max(20.0),
228 color: lp.get_primary(),
229 });
230 dl.push(DrawCommand::Circle {
231 center: Point::new(bounds.get_x() + bw * 0.56, bounds.get_y() + bh * 0.42),
232 radius: (bh * 0.30).max(18.0),
233 color: lp.get_success(),
234 });
235 dl.push(DrawCommand::Circle {
236 center: Point::new(bounds.get_x() + bw * 0.80, bounds.get_y() + bh * 0.58),
237 radius: (bh * 0.28).max(16.0),
238 color: lp.get_warning(),
239 });
240 };
241 let glass_style = move || -> Style {
242 let live: ThemeTokens = use_live_tokens(tokens);
243 let lp: ThemePalette = live.get_palette();
244 let lg: ThemeGeometry = live.get_geometry();
245 Style::default()
246 .position(Position::Absolute)
247 .inset(
248 Some(SPACE_LG),
249 Some(SPACE_LG),
250 Some(SPACE_LG),
251 Some(SPACE_LG),
252 )
253 .column()
254 .justify(JustifyContent::Center)
255 .gap(SPACE_XS)
256 .padding(Edges::all(SPACE_MD))
257 .background(lp.get_card().with_alpha(196))
258 .border(lg.get_border_width(), lp.get_border())
259 .radius(lg.get_radius_md())
260 .overflow(Overflow::Hidden)
261 };
262 let glass_title_style = move || -> Style {
263 let live: ThemeTokens = use_live_tokens(tokens);
264 Style::default()
265 .width(Length::Percent(100.0))
266 .font_size(14.0)
267 .font_weight(FontWeight::Bold)
268 .color(live.get_palette().get_card_foreground())
269 };
270 let glass_sub_style = move || -> Style {
271 let live: ThemeTokens = use_live_tokens(tokens);
272 Style::default()
273 .width(Length::Percent(100.0))
274 .font_size(12.0)
275 .font_family(FontFamily::Monospace)
276 .color(live.get_palette().get_card_foreground())
277 };
278 let blur_caption = move || -> String {
279 let radius: f32 = render_blur_radius(blur_idx.get());
280 format!("Dual-Kawase radius: {radius:.0}px | alpha=196/255")
281 };
282 let card: NodeId = view! {
283 EuvCard {
284 title: RENDER_BLUR_CARD_TITLE.to_string()
285 tokens: tokens
286 subtitle: RENDER_BLUR_CARD_SUB
287 view {
288 style: {
289 width: Length::Percent(100.0)
290 height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
291 background: p.get_muted()
292 border: (g.get_border_width(), p.get_border())
293 radius: g.get_radius_md()
294 overflow: Overflow::Hidden
295 }
296 canvas {
297 style: {
298 width: Length::Percent(100.0)
299 height: Length::Percent(100.0)
300 }
301 painter: paint_backdrop
302 }
303 view {
304 node_ref: glass_id
305 bind_style: glass_style
306 text {
307 bind_style: glass_title_style
308 { RENDER_BLUR_GLASS_TITLE }
309 }
310 text {
311 bind_style: glass_sub_style
312 { blur_caption }
313 }
314 }
315 }
316 }
317 };
318 (card, glass_id)
319}
320
321pub(crate) fn mount_render_shadow_card(shadow_idx: Signal<usize>, tokens: ThemeTokens) -> NodeId {
332 let p: ThemePalette = tokens.get_palette();
333 let g: ThemeGeometry = tokens.get_geometry();
334 let tile_style = move || -> Style {
335 let live: ThemeTokens = use_live_tokens(tokens);
336 let lp: ThemePalette = live.get_palette();
337 let lg: ThemeGeometry = live.get_geometry();
338 let sh: Shadow = match shadow_idx.get() {
339 0 => lg.get_shadow_sm(),
340 2 => lg.get_shadow_lg(),
341 _ => lg.get_shadow_md(),
342 };
343 Style::default()
344 .column()
345 .width(Length::Percent(100.0))
346 .padding(Edges::all(SPACE_MD))
347 .gap(SPACE_XS)
348 .background(lp.get_card())
349 .border(lg.get_border_width(), lp.get_border())
350 .radius(lg.get_radius_lg())
351 .shadow(sh)
352 .overflow(Overflow::Hidden)
353 };
354 let tile_title_style = move || -> Style {
355 let live: ThemeTokens = use_live_tokens(tokens);
356 Style::default()
357 .width(Length::Percent(100.0))
358 .font_size(14.0)
359 .font_weight(FontWeight::Bold)
360 .color(live.get_palette().get_card_foreground())
361 };
362 let tile_meta_style = move || -> Style {
363 let live: ThemeTokens = use_live_tokens(tokens);
364 Style::default()
365 .width(Length::Percent(100.0))
366 .font_size(12.0)
367 .font_family(FontFamily::Monospace)
368 .color(live.get_palette().get_muted_foreground())
369 };
370 let shadow_meta = move || -> String {
371 let live: ThemeTokens = use_live_tokens(tokens);
372 let lg: ThemeGeometry = live.get_geometry();
373 let (tier, sh): (&str, Shadow) = match shadow_idx.get() {
374 0 => (RENDER_SHADOW_OPT_SM, lg.get_shadow_sm()),
375 2 => (RENDER_SHADOW_OPT_LG, lg.get_shadow_lg()),
376 _ => (RENDER_SHADOW_OPT_MD, lg.get_shadow_md()),
377 };
378 format!(
379 "{tier} | offset=({:.0},{:.0}) blur={:.0}px",
380 sh.get_offset_x(),
381 sh.get_offset_y(),
382 sh.get_blur_radius()
383 )
384 };
385 view! {
386 EuvCard {
387 title: RENDER_SHADOW_CARD_TITLE.to_string()
388 tokens: tokens
389 subtitle: RENDER_SHADOW_CARD_SUB
390 column {
391 style: {
392 width: Length::Percent(100.0)
393 height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
394 padding: Edges::all(SPACE_LG)
395 justify: JustifyContent::Center
396 background: p.get_muted()
397 border: (g.get_border_width(), p.get_border())
398 radius: g.get_radius_md()
399 overflow: Overflow::Hidden
400 }
401 view {
402 bind_style: tile_style
403 text {
404 bind_style: tile_title_style
405 { RENDER_SHADOW_SAMPLE_TITLE }
406 }
407 text {
408 bind_style: tile_meta_style
409 { shadow_meta }
410 }
411 }
412 }
413 }
414 }
415}
416
417pub(crate) fn mount_render_gradient_card(angle_idx: Signal<usize>, tokens: ThemeTokens) -> NodeId {
428 let grad_box_style = move || -> Style {
429 let live: ThemeTokens = use_live_tokens(tokens);
430 let lp: ThemePalette = live.get_palette();
431 let lg: ThemeGeometry = live.get_geometry();
432 let angle: f32 = render_gradient_angle(angle_idx.get());
433 let grad: LinearGradient = LinearGradient::new(angle, lp.get_primary(), lp.get_success());
434 Style::default()
435 .column()
436 .width(Length::Percent(100.0))
437 .height(Length::Px(RENDER_EFFECT_STAGE_HEIGHT))
438 .padding(Edges::all(SPACE_MD))
439 .justify(JustifyContent::End)
440 .gap(SPACE_XS)
441 .background(lp.get_primary())
442 .gradient(grad)
443 .border(lg.get_border_width(), lp.get_border())
444 .radius(lg.get_radius_md())
445 .overflow(Overflow::Hidden)
446 };
447 let grad_title_style = move || -> Style {
448 let live: ThemeTokens = use_live_tokens(tokens);
449 Style::default()
450 .width(Length::Percent(100.0))
451 .font_size(14.0)
452 .font_weight(FontWeight::Bold)
453 .color(live.get_palette().get_primary_foreground())
454 };
455 let grad_meta_style = move || -> Style {
456 let live: ThemeTokens = use_live_tokens(tokens);
457 Style::default()
458 .width(Length::Percent(100.0))
459 .font_size(12.0)
460 .font_family(FontFamily::Monospace)
461 .color(live.get_palette().get_primary_foreground())
462 };
463 let grad_meta = move || -> String {
464 let angle: f32 = render_gradient_angle(angle_idx.get());
465 format!("LinearGradient({angle:.0} deg, primary -> success)")
466 };
467 view! {
468 EuvCard {
469 title: RENDER_GRADIENT_CARD_TITLE.to_string()
470 tokens: tokens
471 subtitle: RENDER_GRADIENT_CARD_SUB
472 view {
473 bind_style: grad_box_style
474 text {
475 bind_style: grad_title_style
476 { RENDER_GRADIENT_SAMPLE_TITLE }
477 }
478 text {
479 bind_style: grad_meta_style
480 { grad_meta }
481 }
482 }
483 }
484 }
485}
486
487pub(crate) fn mount_render_damage_card(
498 pulse_sig: Signal<u32>,
499 tokens: ThemeTokens,
500) -> (NodeId, NodeId) {
501 let p: ThemePalette = tokens.get_palette();
502 let g: ThemeGeometry = tokens.get_geometry();
503 let mut damage_canvas_id: NodeId = NodeId::default();
504 let paint_damage = move |bounds: Rect, dl: &mut DisplayList| {
505 let live: ThemeTokens = live_tokens_untracked(tokens);
506 let lp: ThemePalette = live.get_palette();
507 let pulse: u32 = pulse_sig.get_untracked();
508 let cols: usize = 4;
509 let rows: usize = 2;
510 let pad: f32 = 10.0;
511 let gap: f32 = 6.0;
512 let usable_w: f32 = (bounds.get_width() - pad * 2.0 - gap * ((cols - 1) as f32)).max(40.0);
513 let usable_h: f32 =
514 (bounds.get_height() - 28.0 - pad * 2.0 - gap * ((rows - 1) as f32)).max(24.0);
515 let cell_w: f32 = usable_w / (cols as f32);
516 let cell_h: f32 = usable_h / (rows as f32);
517 let active_idx: usize = (pulse as usize) % (cols * rows);
518 for row in 0..rows {
519 for col in 0..cols {
520 let idx: usize = row * cols + col;
521 let rx: f32 = bounds.get_x() + pad + (col as f32) * (cell_w + gap);
522 let ry: f32 = bounds.get_y() + 26.0 + pad + (row as f32) * (cell_h + gap);
523 let is_dirty: bool = idx == active_idx;
524 let fill: Color = if is_dirty {
525 lp.get_warning().with_alpha(96)
526 } else {
527 lp.get_card()
528 };
529 let stroke: Color = if is_dirty {
530 lp.get_warning()
531 } else {
532 lp.get_border()
533 };
534 dl.push(DrawCommand::FillRoundedRect {
535 rect: Rect::new(rx, ry, cell_w, cell_h),
536 color: fill,
537 radius: CornerRadius::all(6.0),
538 border: Border::new(if is_dirty { 2.0 } else { 1.0 }, stroke),
539 });
540 }
541 }
542 let mut hud_style: TextStyle = TextStyle::default();
543 hud_style
544 .set_font_size(11.5)
545 .set_weight(FontWeight::SemiBold)
546 .set_color(lp.get_foreground());
547 dl.push(DrawCommand::TextRun {
548 rect: Rect::new(
549 bounds.get_x() + 10.0,
550 bounds.get_y() + 8.0,
551 (bounds.get_width() - 20.0).max(1.0),
552 18.0,
553 ),
554 text: format!("DIRTY_PAINT Pulses: {pulse} | Active Tile: #{active_idx}"),
555 style: hud_style,
556 });
557 };
558 let card: NodeId = view! {
559 EuvCard {
560 title: RENDER_DAMAGE_CARD_TITLE.to_string()
561 tokens: tokens
562 subtitle: RENDER_DAMAGE_CARD_SUB
563 canvas {
564 node_ref: damage_canvas_id
565 style: {
566 width: Length::Percent(100.0)
567 height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
568 background: p.get_muted()
569 border: (g.get_border_width(), p.get_border())
570 radius: g.get_radius_md()
571 }
572 painter: paint_damage
573 }
574 }
575 };
576 (card, damage_canvas_id)
577}
578
579pub fn mount_render_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
590 let p: ThemePalette = tokens.get_palette();
591 let ctx: Context = current_context();
592 let mode_idx: Signal<usize> = state.get_render_mode_index();
593 let blur_idx: Signal<usize> = Signal::new(1);
594 let shadow_idx: Signal<usize> = Signal::new(1);
595 let angle_idx: Signal<usize> = Signal::new(1);
596 let damage_pulse: Signal<u32> = Signal::new(0);
597 let (vector_card, vector_canvas_id): (NodeId, NodeId) =
598 mount_render_vector_card(mode_idx, tokens);
599 let (blur_card, glass_id): (NodeId, NodeId) = mount_render_blur_card(blur_idx, tokens);
600 let shadow_card: NodeId = mount_render_shadow_card(shadow_idx, tokens);
601 let gradient_card: NodeId = mount_render_gradient_card(angle_idx, tokens);
602 let (damage_card, damage_canvas_id): (NodeId, NodeId) =
603 mount_render_damage_card(damage_pulse, tokens);
604 let effects_grid: NodeId =
605 mount_responsive_grid(vec![blur_card, shadow_card, gradient_card, damage_card], 2);
606 let pulse_scene: SceneHandle = ctx.get_scene().clone();
607 let on_pulse_dirty = move |_: &UiEvent| {
608 let _: bool = damage_pulse.update(|n: &mut u32| *n = n.saturating_add(1));
609 pulse_scene.mark_dirty(damage_canvas_id, DIRTY_PAINT);
610 };
611 let pulse_readout = move || -> String {
612 format!(
613 "Surgical DIRTY_PAINT count: {} (zero global layout rebuild)",
614 damage_pulse.get()
615 )
616 };
617 let pipeline_card: NodeId = view! {
618 EuvCard {
619 title: RENDER_PIPELINE_CARD_TITLE.to_string()
620 tokens: tokens
621 subtitle: RENDER_PIPELINE_CARD_SUB
622 EuvSegmented {
623 options: vec![
624 MODE_AUTO.to_string(),
625 MODE_SOFTWARE.to_string(),
626 MODE_HARDWARE.to_string(),
627 MODE_HYBRID.to_string(),
628 ]
629 selected: mode_idx
630 tokens: tokens
631 }
632 }
633 };
634 let controls_card: NodeId = view! {
635 EuvCard {
636 title: RENDER_CONTROLS_CARD_TITLE.to_string()
637 tokens: tokens
638 subtitle: RENDER_CONTROLS_CARD_SUB
639 column {
640 style: {
641 width: Length::Percent(100.0)
642 gap: SPACE_SM
643 }
644 text {
645 style: {
646 width: Length::Percent(100.0)
647 font_size: 12.0
648 font_weight: FontWeight::Medium
649 color: p.get_muted_foreground()
650 }
651 { RENDER_LABEL_BLUR_RADIUS }
652 }
653 EuvSegmented {
654 options: vec![
655 RENDER_BLUR_OPT_8.to_string(),
656 RENDER_BLUR_OPT_16.to_string(),
657 RENDER_BLUR_OPT_24.to_string(),
658 ]
659 selected: blur_idx
660 tokens: tokens
661 }
662 text {
663 style: {
664 width: Length::Percent(100.0)
665 font_size: 12.0
666 font_weight: FontWeight::Medium
667 color: p.get_muted_foreground()
668 }
669 { RENDER_LABEL_SHADOW_TIER }
670 }
671 EuvSegmented {
672 options: vec![
673 RENDER_SHADOW_OPT_SM.to_string(),
674 RENDER_SHADOW_OPT_MD.to_string(),
675 RENDER_SHADOW_OPT_LG.to_string(),
676 ]
677 selected: shadow_idx
678 tokens: tokens
679 }
680 text {
681 style: {
682 width: Length::Percent(100.0)
683 font_size: 12.0
684 font_weight: FontWeight::Medium
685 color: p.get_muted_foreground()
686 }
687 { RENDER_LABEL_GRADIENT_ANGLE }
688 }
689 EuvSegmented {
690 options: vec![
691 RENDER_ANGLE_0.to_string(),
692 RENDER_ANGLE_45.to_string(),
693 RENDER_ANGLE_90.to_string(),
694 RENDER_ANGLE_135.to_string(),
695 ]
696 selected: angle_idx
697 tokens: tokens
698 }
699 EuvActionRow {
700 EuvButton {
701 label: RENDER_BTN_PULSE_DIRTY.to_string()
702 tokens: tokens
703 sm()
704 on_click: on_pulse_dirty
705 }
706 }
707 text {
708 style: {
709 width: Length::Percent(100.0)
710 font_size: 12.0
711 font_family: FontFamily::Monospace
712 color: p.get_primary()
713 }
714 { pulse_readout }
715 }
716 }
717 }
718 };
719 let rail: NodeId = view! {
720 column {
721 style: {
722 width: Length::Percent(100.0)
723 gap: SPACE_MD
724 }
725 { pipeline_card }
726 { controls_card }
727 }
728 };
729 let main: NodeId = view! {
730 column {
731 style: {
732 width: Length::Percent(100.0)
733 gap: SPACE_MD
734 }
735 { vector_card }
736 { effects_grid }
737 }
738 };
739 let studio: NodeId = mount_studio_layout(main, rail);
740 let page: NodeId = view! {
741 EuvPage {
742 title: RENDER_TITLE.to_string()
743 subtitle: RENDER_SUBTITLE.to_string()
744 tokens: tokens
745 { studio }
746 }
747 };
748 let scene_for_mode: SceneHandle = ctx.get_scene().clone();
749 let scene_for_blur: SceneHandle = ctx.get_scene().clone();
750 let (render_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
751 let _: Effect = Effect::new(move || {
752 let _: usize = mode_idx.get();
753 scene_for_mode.mark_dirty(vector_canvas_id, DIRTY_PAINT);
754 });
755 Effect::new(move || {
756 let radius: f32 = render_blur_radius(blur_idx.get());
757 scene_for_blur.with_write(
758 |tree: &mut SceneTree| {
759 tree.set_backdrop_blur(glass_id, radius);
760 tree.mark_dirty(glass_id, DIRTY_PAINT);
761 },
762 (),
763 );
764 })
765 });
766 ctx.get_scene().with_write(
767 |tree: &mut SceneTree| {
768 tree.attach_scope(page, render_scope);
769 },
770 (),
771 );
772 page
773}