pub fn Canvas(
__arg0: Modifier,
on_draw: impl Fn(&mut dyn DrawScope) + 'static,
) -> usizeExpand description
Draws custom content through a DrawScope. The modifier sets canvas bounds.
The draw scope also measures and draws text with the app’s fonts.
§Example
use cranpose_ui::*;
#[composable]
fn ColorPanel() {
Canvas(Modifier::empty().size_points(200.0, 100.0), |scope| {
scope.draw_rect(Brush::solid(Color::RED));
});
}For text, use DrawTextStyle, DrawScope::measure_text and
DrawScope::draw_text_from to place a label within the canvas.