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 .width(Length::Percent(100.0))
247 .flex_grow(1.0)
248 .column()
249 .justify(JustifyContent::Center)
250 .gap(SPACE_XS)
251 .padding(Edges::all(SPACE_MD))
252 .background(lp.get_card().with_alpha(196))
253 .border(lg.get_border_width(), lp.get_border())
254 .radius(lg.get_radius_md())
255 .overflow(Overflow::Hidden)
256 };
257 let glass_title_style = move || -> Style {
258 let live: ThemeTokens = use_live_tokens(tokens);
259 Style::default()
260 .width(Length::Percent(100.0))
261 .font_size(14.0)
262 .font_weight(FontWeight::Bold)
263 .color(live.get_palette().get_card_foreground())
264 };
265 let glass_sub_style = move || -> Style {
266 let live: ThemeTokens = use_live_tokens(tokens);
267 Style::default()
268 .width(Length::Percent(100.0))
269 .font_size(12.0)
270 .font_family(FontFamily::Monospace)
271 .color(live.get_palette().get_card_foreground())
272 };
273 let blur_caption = move || -> String {
274 let radius: f32 = render_blur_radius(blur_idx.get());
275 format!("Dual-Kawase radius: {radius:.0}px | alpha=196/255")
276 };
277 let card: NodeId = view! {
278 EuvCard {
279 title: RENDER_BLUR_CARD_TITLE.to_string()
280 tokens: tokens
281 subtitle: RENDER_BLUR_CARD_SUB
282 view {
283 style: {
284 width: Length::Percent(100.0)
285 height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
286 padding: Edges::all(SPACE_LG)
287 justify: JustifyContent::Center
288 background: p.get_muted()
289 border: (g.get_border_width(), p.get_border())
290 radius: g.get_radius_md()
291 overflow: Overflow::Hidden
292 }
293 canvas {
294 style: {
295 position: Position::Absolute
296 inset: (Some(0.0), Some(0.0), Some(0.0), Some(0.0))
297 width: Length::Percent(100.0)
298 height: Length::Percent(100.0)
299 }
300 painter: paint_backdrop
301 }
302 view {
303 node_ref: glass_id
304 bind_style: glass_style
305 text {
306 bind_style: glass_title_style
307 { RENDER_BLUR_GLASS_TITLE }
308 }
309 text {
310 bind_style: glass_sub_style
311 { blur_caption }
312 }
313 }
314 }
315 }
316 };
317 (card, glass_id)
318}
319
320pub(crate) fn mount_render_shadow_card(shadow_idx: Signal<usize>, tokens: ThemeTokens) -> NodeId {
331 let p: ThemePalette = tokens.get_palette();
332 let g: ThemeGeometry = tokens.get_geometry();
333 let tile_style = move || -> Style {
334 let live: ThemeTokens = use_live_tokens(tokens);
335 let lp: ThemePalette = live.get_palette();
336 let lg: ThemeGeometry = live.get_geometry();
337 let sh: Shadow = match shadow_idx.get() {
338 0 => lg.get_shadow_sm(),
339 2 => lg.get_shadow_lg(),
340 _ => lg.get_shadow_md(),
341 };
342 Style::default()
343 .column()
344 .width(Length::Percent(100.0))
345 .padding(Edges::all(SPACE_MD))
346 .gap(SPACE_XS)
347 .background(lp.get_card())
348 .border(lg.get_border_width(), lp.get_border())
349 .radius(lg.get_radius_lg())
350 .shadow(sh)
351 .overflow(Overflow::Hidden)
352 };
353 let tile_title_style = move || -> Style {
354 let live: ThemeTokens = use_live_tokens(tokens);
355 Style::default()
356 .width(Length::Percent(100.0))
357 .font_size(14.0)
358 .font_weight(FontWeight::Bold)
359 .color(live.get_palette().get_card_foreground())
360 };
361 let tile_meta_style = move || -> Style {
362 let live: ThemeTokens = use_live_tokens(tokens);
363 Style::default()
364 .width(Length::Percent(100.0))
365 .font_size(12.0)
366 .font_family(FontFamily::Monospace)
367 .color(live.get_palette().get_muted_foreground())
368 };
369 let shadow_meta = move || -> String {
370 let live: ThemeTokens = use_live_tokens(tokens);
371 let lg: ThemeGeometry = live.get_geometry();
372 let (tier, sh): (&str, Shadow) = match shadow_idx.get() {
373 0 => (RENDER_SHADOW_OPT_SM, lg.get_shadow_sm()),
374 2 => (RENDER_SHADOW_OPT_LG, lg.get_shadow_lg()),
375 _ => (RENDER_SHADOW_OPT_MD, lg.get_shadow_md()),
376 };
377 format!(
378 "{tier} | offset=({:.0},{:.0}) blur={:.0}px",
379 sh.get_offset_x(),
380 sh.get_offset_y(),
381 sh.get_blur_radius()
382 )
383 };
384 view! {
385 EuvCard {
386 title: RENDER_SHADOW_CARD_TITLE.to_string()
387 tokens: tokens
388 subtitle: RENDER_SHADOW_CARD_SUB
389 column {
390 style: {
391 width: Length::Percent(100.0)
392 height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
393 padding: Edges::all(SPACE_LG)
394 justify: JustifyContent::Center
395 background: p.get_muted()
396 border: (g.get_border_width(), p.get_border())
397 radius: g.get_radius_md()
398 overflow: Overflow::Hidden
399 }
400 view {
401 bind_style: tile_style
402 text {
403 bind_style: tile_title_style
404 { RENDER_SHADOW_SAMPLE_TITLE }
405 }
406 text {
407 bind_style: tile_meta_style
408 { shadow_meta }
409 }
410 }
411 }
412 }
413 }
414}
415
416pub(crate) fn mount_render_gradient_card(angle_idx: Signal<usize>, tokens: ThemeTokens) -> NodeId {
427 let grad_box_style = move || -> Style {
428 let live: ThemeTokens = use_live_tokens(tokens);
429 let lp: ThemePalette = live.get_palette();
430 let lg: ThemeGeometry = live.get_geometry();
431 let angle: f32 = render_gradient_angle(angle_idx.get());
432 let grad: LinearGradient = LinearGradient::new(angle, lp.get_primary(), lp.get_success());
433 Style::default()
434 .column()
435 .width(Length::Percent(100.0))
436 .height(Length::Px(RENDER_EFFECT_STAGE_HEIGHT))
437 .padding(Edges::all(SPACE_MD))
438 .justify(JustifyContent::End)
439 .gap(SPACE_XS)
440 .background(lp.get_primary())
441 .gradient(grad)
442 .border(lg.get_border_width(), lp.get_border())
443 .radius(lg.get_radius_md())
444 .overflow(Overflow::Hidden)
445 };
446 let grad_title_style = move || -> Style {
447 let live: ThemeTokens = use_live_tokens(tokens);
448 Style::default()
449 .width(Length::Percent(100.0))
450 .font_size(14.0)
451 .font_weight(FontWeight::Bold)
452 .color(live.get_palette().get_primary_foreground())
453 };
454 let grad_meta_style = move || -> Style {
455 let live: ThemeTokens = use_live_tokens(tokens);
456 Style::default()
457 .width(Length::Percent(100.0))
458 .font_size(12.0)
459 .font_family(FontFamily::Monospace)
460 .color(live.get_palette().get_primary_foreground())
461 };
462 let grad_meta = move || -> String {
463 let angle: f32 = render_gradient_angle(angle_idx.get());
464 format!("LinearGradient({angle:.0} deg, primary -> success)")
465 };
466 view! {
467 EuvCard {
468 title: RENDER_GRADIENT_CARD_TITLE.to_string()
469 tokens: tokens
470 subtitle: RENDER_GRADIENT_CARD_SUB
471 view {
472 bind_style: grad_box_style
473 text {
474 bind_style: grad_title_style
475 { RENDER_GRADIENT_SAMPLE_TITLE }
476 }
477 text {
478 bind_style: grad_meta_style
479 { grad_meta }
480 }
481 }
482 }
483 }
484}
485
486pub(crate) fn mount_render_damage_card(
497 pulse_sig: Signal<u32>,
498 tokens: ThemeTokens,
499) -> (NodeId, NodeId) {
500 let p: ThemePalette = tokens.get_palette();
501 let g: ThemeGeometry = tokens.get_geometry();
502 let mut damage_canvas_id: NodeId = NodeId::default();
503 let paint_damage = move |bounds: Rect, dl: &mut DisplayList| {
504 let live: ThemeTokens = live_tokens_untracked(tokens);
505 let lp: ThemePalette = live.get_palette();
506 let pulse: u32 = pulse_sig.get_untracked();
507 let cols: usize = 4;
508 let rows: usize = 2;
509 let pad: f32 = 10.0;
510 let gap: f32 = 6.0;
511 let usable_w: f32 = (bounds.get_width() - pad * 2.0 - gap * ((cols - 1) as f32)).max(40.0);
512 let usable_h: f32 =
513 (bounds.get_height() - 28.0 - pad * 2.0 - gap * ((rows - 1) as f32)).max(24.0);
514 let cell_w: f32 = usable_w / (cols as f32);
515 let cell_h: f32 = usable_h / (rows as f32);
516 let active_idx: usize = (pulse as usize) % (cols * rows);
517 for row in 0..rows {
518 for col in 0..cols {
519 let idx: usize = row * cols + col;
520 let rx: f32 = bounds.get_x() + pad + (col as f32) * (cell_w + gap);
521 let ry: f32 = bounds.get_y() + 26.0 + pad + (row as f32) * (cell_h + gap);
522 let is_dirty: bool = idx == active_idx;
523 let fill: Color = if is_dirty {
524 lp.get_warning().with_alpha(96)
525 } else {
526 lp.get_card()
527 };
528 let stroke: Color = if is_dirty {
529 lp.get_warning()
530 } else {
531 lp.get_border()
532 };
533 dl.push(DrawCommand::FillRoundedRect {
534 rect: Rect::new(rx, ry, cell_w, cell_h),
535 color: fill,
536 radius: CornerRadius::all(6.0),
537 border: Border::new(if is_dirty { 2.0 } else { 1.0 }, stroke),
538 });
539 }
540 }
541 let mut hud_style: TextStyle = TextStyle::default();
542 hud_style
543 .set_font_size(11.5)
544 .set_weight(FontWeight::SemiBold)
545 .set_color(lp.get_foreground());
546 dl.push(DrawCommand::TextRun {
547 rect: Rect::new(
548 bounds.get_x() + 10.0,
549 bounds.get_y() + 8.0,
550 (bounds.get_width() - 20.0).max(1.0),
551 18.0,
552 ),
553 text: format!("DIRTY_PAINT Pulses: {pulse} | Active Tile: #{active_idx}"),
554 style: hud_style,
555 });
556 };
557 let card: NodeId = view! {
558 EuvCard {
559 title: RENDER_DAMAGE_CARD_TITLE.to_string()
560 tokens: tokens
561 subtitle: RENDER_DAMAGE_CARD_SUB
562 canvas {
563 node_ref: damage_canvas_id
564 style: {
565 width: Length::Percent(100.0)
566 height: Length::Px(RENDER_EFFECT_STAGE_HEIGHT)
567 background: p.get_muted()
568 border: (g.get_border_width(), p.get_border())
569 radius: g.get_radius_md()
570 }
571 painter: paint_damage
572 }
573 }
574 };
575 (card, damage_canvas_id)
576}
577
578pub fn mount_render_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
589 let p: ThemePalette = tokens.get_palette();
590 let ctx: Context = current_context();
591 let mode_idx: Signal<usize> = state.get_render_mode_index();
592 let blur_idx: Signal<usize> = Signal::new(1);
593 let shadow_idx: Signal<usize> = Signal::new(1);
594 let angle_idx: Signal<usize> = Signal::new(1);
595 let damage_pulse: Signal<u32> = Signal::new(0);
596 let (vector_card, vector_canvas_id): (NodeId, NodeId) =
597 mount_render_vector_card(mode_idx, tokens);
598 let (blur_card, glass_id): (NodeId, NodeId) = mount_render_blur_card(blur_idx, tokens);
599 let shadow_card: NodeId = mount_render_shadow_card(shadow_idx, tokens);
600 let gradient_card: NodeId = mount_render_gradient_card(angle_idx, tokens);
601 let (damage_card, damage_canvas_id): (NodeId, NodeId) =
602 mount_render_damage_card(damage_pulse, tokens);
603 let effects_grid: NodeId =
604 mount_responsive_grid(vec![blur_card, shadow_card, gradient_card, damage_card], 2);
605 let pulse_scene: SceneHandle = ctx.get_scene().clone();
606 let on_pulse_dirty = move |_: &UiEvent| {
607 let _: bool = damage_pulse.update(|n: &mut u32| *n = n.saturating_add(1));
608 pulse_scene.mark_dirty(damage_canvas_id, DIRTY_PAINT);
609 };
610 let pulse_readout = move || -> String {
611 format!(
612 "Surgical DIRTY_PAINT count: {} (zero global layout rebuild)",
613 damage_pulse.get()
614 )
615 };
616 let pipeline_card: NodeId = view! {
617 EuvCard {
618 title: RENDER_PIPELINE_CARD_TITLE.to_string()
619 tokens: tokens
620 subtitle: RENDER_PIPELINE_CARD_SUB
621 EuvSegmented {
622 options: vec![
623 MODE_AUTO.to_string(),
624 MODE_SOFTWARE.to_string(),
625 MODE_HARDWARE.to_string(),
626 MODE_HYBRID.to_string(),
627 ]
628 selected: mode_idx
629 tokens: tokens
630 }
631 }
632 };
633 let controls_card: NodeId = view! {
634 EuvCard {
635 title: RENDER_CONTROLS_CARD_TITLE.to_string()
636 tokens: tokens
637 subtitle: RENDER_CONTROLS_CARD_SUB
638 column {
639 style: {
640 width: Length::Percent(100.0)
641 gap: SPACE_SM
642 }
643 text {
644 style: {
645 width: Length::Percent(100.0)
646 font_size: 12.0
647 font_weight: FontWeight::Medium
648 color: p.get_muted_foreground()
649 }
650 { RENDER_LABEL_BLUR_RADIUS }
651 }
652 EuvSegmented {
653 options: vec![
654 RENDER_BLUR_OPT_8.to_string(),
655 RENDER_BLUR_OPT_16.to_string(),
656 RENDER_BLUR_OPT_24.to_string(),
657 ]
658 selected: blur_idx
659 tokens: tokens
660 }
661 text {
662 style: {
663 width: Length::Percent(100.0)
664 font_size: 12.0
665 font_weight: FontWeight::Medium
666 color: p.get_muted_foreground()
667 }
668 { RENDER_LABEL_SHADOW_TIER }
669 }
670 EuvSegmented {
671 options: vec![
672 RENDER_SHADOW_OPT_SM.to_string(),
673 RENDER_SHADOW_OPT_MD.to_string(),
674 RENDER_SHADOW_OPT_LG.to_string(),
675 ]
676 selected: shadow_idx
677 tokens: tokens
678 }
679 text {
680 style: {
681 width: Length::Percent(100.0)
682 font_size: 12.0
683 font_weight: FontWeight::Medium
684 color: p.get_muted_foreground()
685 }
686 { RENDER_LABEL_GRADIENT_ANGLE }
687 }
688 EuvSegmented {
689 options: vec![
690 RENDER_ANGLE_0.to_string(),
691 RENDER_ANGLE_45.to_string(),
692 RENDER_ANGLE_90.to_string(),
693 RENDER_ANGLE_135.to_string(),
694 ]
695 selected: angle_idx
696 tokens: tokens
697 }
698 EuvActionRow {
699 EuvButton {
700 label: RENDER_BTN_PULSE_DIRTY.to_string()
701 tokens: tokens
702 sm()
703 on_click: on_pulse_dirty
704 }
705 }
706 text {
707 style: {
708 width: Length::Percent(100.0)
709 font_size: 12.0
710 font_family: FontFamily::Monospace
711 color: p.get_primary()
712 }
713 { pulse_readout }
714 }
715 }
716 }
717 };
718 let rail: NodeId = view! {
719 column {
720 style: {
721 width: Length::Percent(100.0)
722 gap: SPACE_MD
723 }
724 { pipeline_card }
725 { controls_card }
726 }
727 };
728 let main: NodeId = view! {
729 column {
730 style: {
731 width: Length::Percent(100.0)
732 gap: SPACE_MD
733 }
734 { vector_card }
735 { effects_grid }
736 }
737 };
738 let studio: NodeId = mount_studio_layout(main, rail);
739 let page: NodeId = view! {
740 EuvPage {
741 title: RENDER_TITLE.to_string()
742 subtitle: RENDER_SUBTITLE.to_string()
743 tokens: tokens
744 { studio }
745 }
746 };
747 let scene_for_mode: SceneHandle = ctx.get_scene().clone();
748 let scene_for_blur: SceneHandle = ctx.get_scene().clone();
749 let (render_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
750 let _: Effect = Effect::new(move || {
751 let _: usize = mode_idx.get();
752 scene_for_mode.mark_dirty(vector_canvas_id, DIRTY_PAINT);
753 });
754 Effect::new(move || {
755 let radius: f32 = render_blur_radius(blur_idx.get());
756 scene_for_blur.with_write(
757 |tree: &mut SceneTree| {
758 tree.set_backdrop_blur(glass_id, radius);
759 tree.mark_dirty(glass_id, DIRTY_PAINT);
760 },
761 (),
762 );
763 })
764 });
765 ctx.get_scene().with_write(
766 |tree: &mut SceneTree| {
767 tree.attach_scope(page, render_scope);
768 },
769 (),
770 );
771 page
772}