Canvas
The Canvas allows the drawing of custom content.
component Canvas
import { Canvas, Painter, Rect } from ui
export var main = Canvas(
paint: fun (painter: Painter, frame: Rect) {
painter.set_fill(Color(0xFF20639B))
painter.draw_rect(frame)
}
)
Note
Heavy use of the Canvas component can lead to performance issues, so avoid it if alternative implementations are possible.
Constructor
background_color: Color = Color(0x00000000)
The background color to fill the canvas with.
opaque: Bool = false
Set this to true if the Canvas doesn't need to be blended with the rest of your UI to speed up drawing.