local dlg = Dialog()
dlg :canvas{
width = 200,
height = 200,
onpaint = function(ev)
local gc = ev.context
gc.opacity = 255
gc.blendMode = BlendMode.NORMAL
local preview = app.sprite
gc:save()
-- Create a rectangle and use it as a clipping region
gc:beginPath()
gc:rect(Rectangle(10, 10, 100, 40))
gc:clip()
gc: drawImage(preview, 20,20)
end
}
:show{wait=false}
Hello, I want to create a preview function.
what I want to do is draw ‘app.sprite’ used GraphicsContext.
I don’t know why this program can’t draw the sprite.
please tell me.
edit: image exists at [ layer1 frame1]