我尝试了许多方法来捕捉屏幕使用corona,我读了http://docs.coronalabs.com/api/library/display/captureScreen.html
然而,当我运行这个程序时,Corona sdk冻结并不得不关闭它,我使用Corona作为windows,有时我得到“运行时错误R6025纯虚拟函数调用”,我尝试了许多与其他人一起工作的示例代码--这里是我的代码。
_W = display.viewableContentWidth
_H = display.viewableContentHeight
local background = display.newRect(0, 0, 320, 480);
background:setFillColor(255,255,255);
local foo = display.newImageRect("images/foo.png",100,100);
foo.anchorX=0.5
foo.anchorY=0.5
foo.x = _W * 0.5;
foo.y = _H * 0.5;
local screenShot = display.captureScreen(true);
foo:removeSelf();
background:removeSelf();
screenShot.xScale = 0.5;
screenShot.yScale = 0.5;
screenShot.rotation = 45;这是我的build.settings文件
androidPermissions =
{
"android.permission.VIBRATE",
"android.permission.WRITE_EXTERNAL_STORAGE"
},发布于 2014-07-25 22:20:55
您还可以尝试使用display.save将屏幕保存到文件中。
请查看勒格码所做的工作
当按下“键”时,此代码将在模拟器中保存一个屏幕快照。
if app.isSimulator then
Runtime:addEventListener('key', function (event)
if event.keyName == 's' and event.phase == 'down' then
local scene = storyboard.getScene(storyboard.getCurrentSceneName())
if scene and scene.view then
display.save(scene.view, display.pixelWidth .. 'x' .. display.pixelHeight .. '_' .. math.floor(system.getTimer()) .. '.png')
return true
end
end
end)
end发布于 2018-09-20 08:48:11
可以使用display.save()函数从作为函数的第一个参数传递的给定显示组保存屏幕快照
https://stackoverflow.com/questions/22096721
复制相似问题