Canvas:begin()method
Starts drawing operations on the Canvas.
Return value
This function returns no value.Example
--! luart-extensions
import ui
require "canvas"
-- create a simple window
local win = ui.Window("canvas.onPaint() sample", "fixed", 500, 400)
local canvas = ui.Canvas(win)
canvas.align = "all"
function canvas:onPaint()
-- Alternates canvas fill using a random color...
self:begin()
self:clear(math.random(0xFFFFFFFF))
self:flip()
sleep(250)
-- ...and a red color
self:begin()
self:clear(0xFF0000FF)
self:flip()
sleep(250)
end
await win:showasync()