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

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