我正在尝试显示一个拍摄后的screenCap,它正在保存screenCap,但我如何才能获得最新的录屏的url?
local screenCap = display.captureScreen( true )
local alert = native.showAlert( "Success", "Screen Capture Saved to Library", { "OK" } )
NewsScreenShot = display.newImage( " path to the PNG file " )发布于 2013-02-26 23:51:09
http://jp.anscamobile.com/dev/reference/index/displaycapturescreen/index.html
该图片将以名称picture X.png保存在设备库中。在此之后,您需要自定义选择最新的索引图片。
顺便说一句,你可以尝试使用display.save("name",path),这将永远是最后保存的图片。
发布于 2013-07-22 13:35:10
display.captureBounds可以很好地将整个屏幕保存到目录中。但它通常会保存上一次索引增加的文件。因此,可能很难正确地阅读它们。所以我更喜欢display.save。但这并不是一条直通的道路。
为此,您必须:
displayGroup.display.save将整个组保存为所需的system.DocumentsDirectory.图像
我在这里给出一个示例:
-- creating the display group --
local localGroup = display.newGroup()
-- creating display objects and adding it to the group --
local bg = display.newRect(0,0,_w,_h)
bg.x = 160
bg.y = 240
bg:setFillColor(150)
localGroup:insert(bg)
local rect = display.newRect(0,0,50,50)
rect.x = 30+math.random(260)
rect.y = 30+math.random(420)
localGroup:insert(rect)
-- Take Screenshot --
local function saveGroupImages()
-- take screen shot to baseDirectory --
local baseDir = system.DocumentsDirectory
display.save( localGroup, "myScreenshot.jpg", baseDir )
end
rect:addEventListener("tap",saveGroupImages)在此之后,您可以读取该文件并按如下方式显示:
local readImage = display.newImage( "myScreenshot.jpg" ,system.DocumentsDirectory , 50, 100 )
readImage.x = 160
readImage.y = 240
readImage:scale(0.5,0.5)继续编码.:)
https://stackoverflow.com/questions/15069113
复制相似问题