summaryrefslogtreecommitdiff
path: root/test/lua/screencapture.lua
diff options
context:
space:
mode:
authorscuri <scuri>2008-10-17 06:10:15 +0000
committerscuri <scuri>2008-10-17 06:10:15 +0000
commit5a422aba704c375a307a902bafe658342e209906 (patch)
tree5005011e086bb863d8fb587ad3319bbec59b2447 /test/lua/screencapture.lua
First commit - moving from LuaForge to SourceForge
Diffstat (limited to 'test/lua/screencapture.lua')
-rw-r--r--test/lua/screencapture.lua13
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
+