Sur mon pc, j'ai copié cet exemple :
--! luart-extensions
import ui
require "canvas"
-- create a simple Window
local win = ui.Window("Image:draw() sample", "fixed", 500, 400)
-- create a Canvas
local canvas = ui.Canvas(win)
canvas.align = "all"
canvas.bgcolor = 0x000000FF
local w = canvas.width
local h = canvas.height
local img = canvas:Image("c:/Prog/img/rond.png")
function canvas:onPaint()
self:begin()
canvas:clear()
img:draw(math.random(w)-80, math.random(h), math.random(), math.random(70,255))
self:flip()
end
await win:showasync()
ATTENTION : Ce code fonctionne très bien tant qu'il commence à la première ligne sur l'éditeur Luart.
Si ce code commence à partir de la deuxième ligne de l'éditeur, alors il ne fonctionnera pas, et je pense que c'est un bug de Luart.
PS ; N'oubliez pas de changer le chemin de l'image.