summaryrefslogtreecommitdiff
path: root/html/examples/screencapture.lua
diff options
context:
space:
mode:
authorscuri <scuri>2009-06-26 17:14:56 +0000
committerscuri <scuri>2009-06-26 17:14:56 +0000
commit193cd3427108bd127e09f391f7fe51f6b62590e9 (patch)
tree7dfd83dec634c15f87f578266f6fdb0df046613a /html/examples/screencapture.lua
parent734afa90c3dda1232e9490d08346be4f2ffefec1 (diff)
*** empty log message ***
Diffstat (limited to 'html/examples/screencapture.lua')
-rw-r--r--html/examples/screencapture.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/html/examples/screencapture.lua b/html/examples/screencapture.lua
new file mode 100644
index 0000000..16eb94e
--- /dev/null
+++ b/html/examples/screencapture.lua
@@ -0,0 +1,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
+