diff options
Diffstat (limited to 'test/lua/screencapture.lua')
-rw-r--r-- | test/lua/screencapture.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/lua/screencapture.lua b/test/lua/screencapture.lua new file mode 100644 index 0000000..5b1a93d --- /dev/null +++ b/test/lua/screencapture.lua @@ -0,0 +1,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 + |