pub fn paint_element<A: 'static>(
tree: &ElementTree<A>,
ctx: &mut PaintCtx<'_>,
element_id: ElementId,
origin: Offset,
)Expand description
Paints a cached retained subtree at an absolute logical-pixel origin.
An unknown element or one without a crate::layout::LayoutResult is a
no-op. The root bounds are its local paint_bounds translated by origin.
Widget base paint runs before children; widget overlay paint runs afterward.
An element’s clip applies only while traversing its children, while ancestor
clips remain active for all descendant work.
Direct child geometry is paired with retained children by index. Extra tree children without a layout record are skipped and extra layout records are ignored. Widget panics propagate and can leave a partially populated paint context; this traversal provides no rollback.
§Examples
use ailloli_ui_core::{ElementId, Offset};
use ailloli_ui_runtime::element::ElementTree;
use ailloli_ui_runtime::scene::{paint_element, PaintCtx};
let tree = ElementTree::<()>::new();
let mut ctx = PaintCtx::new();
paint_element(&tree, &mut ctx, ElementId(99), Offset::new(10.0, 20.0));
assert_eq!(ctx.layers[0].cmds.len(), 0);