diff options
Diffstat (limited to 'html/examples/screencapture.lua')
-rw-r--r-- | html/examples/screencapture.lua | 13 |
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 + |