cocos2dx lua 模糊效果,毛玻璃,背景虛化
阿新 • • 發佈:2019-02-18
function makScreenBlur(callb)
local fileName = "printScreen.png"
-- 移除紋理快取
cc.Director:getInstance():getTextureCache():removeTextureForKey(fileName)
-- self:removeChildByTag(1000)
-- 截圖
cc.utils:captureScreen(function(succeed, outputFile)
if succeed then
if callb then
callb(outputFile)
end
-- local winSize = cc.Director:getInstance():getWinSize()
-- local sp = cc.Sprite:create(outputFile)
-- self:addChild(sp, 2, 1000)
-- sp:setPosition(winSize.width / 2, winSize.height / 2)
-- -- sp:setScale(0.5) -- 顯示縮放
-- print(outputFile)
else
cc.showTextTips("截圖失敗")
end
end, fileName)
local fileName = "printScreen.png"
-- 移除紋理快取
cc.Director:getInstance():getTextureCache():removeTextureForKey(fileName)
-- self:removeChildByTag(1000)
-- 截圖
cc.utils:captureScreen(function(succeed, outputFile)
if succeed then
if callb then
callb(outputFile)
end
-- local winSize = cc.Director:getInstance():getWinSize()
-- local sp = cc.Sprite:create(outputFile)
-- self:addChild(sp, 2, 1000)
-- sp:setPosition(winSize.width / 2, winSize.height / 2)
-- -- sp:setScale(0.5) -- 顯示縮放
-- print(outputFile)
else
cc.showTextTips("截圖失敗")
end
end, fileName)