Function freya::hooks::use_canvas
pub fn use_canvas<D>(
dependencies: D,
renderer_cb: impl Fn(<D as Dependency>::Out) -> Box<dyn Fn(&Canvas, &mut RCHandle<skia_textlayout_FontCollection>, Rect<f32, Measure>) + Send + Sync> + 'static
) -> UseCanvas
Expand description
Register a rendering hook to gain access to the Canvas.
§Usage
fn app() -> Element {
let canvas = use_canvas((), |_| {
Box::new(|canvas, font_collection, area| {
// Draw using the canvas !
})
});
rsx!(
Canvas {
canvas
}
)
}