summaryrefslogtreecommitdiff
path: root/test/lua/screencapture.lua
blob: 16eb94e8b10687f274f2a89bab2e5be87e53b00b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require"imlua"
require"cdlua"
require"cdluaim"

local canvas = cd.CreateCanvas(cd.NATIVEWINDOW, nil)
canvas:Activate()
local w, h = canvas:GetSize()
local image = im.ImageCreate(w, h, im.RGB, im.BYTE)    
image:cdCanvasGetImage(canvas, 0, 0)
error = image:Save("screencapture.jpg", "JPEG")
image:Destroy()        
if (error) then print("error = "..error) end