Canvas:clear( [ color ] ) method


Clears the Canvas drawing surface with the current Canvas.bgcolor or with the provided RGBA color.

Parameters

[ x ]

An optional interger representing a RGBA color value to clear and fill the Canvas with, or the current Canvas background color if omitted.

Return value

This function returns no value.

Example

local ui = require "ui" require "canvas" -- create a simple Window local win = ui.Window("Canvas.clear() sample", "fixed", 320, 200) -- create a Canvas local canvas = ui.Canvas(win) canvas.align = "all" canvas.sync = false win:show() -- update user interface repeat canvas:begin() canvas:clear(math.random(0xFFFFFF00)+0xFF) canvas:flip() ui.update() sleep(250) until not win.visible