/**
* capture screen shot .
* @param imgName String] file name , not include dir
* @param callback function arg count = 1 ; @sub param path file path
* @returns {Boolean}
*/
screenShot: function (imgName,callback) {
var renderTexture = new cc.RenderTexture(cc.visibleRect.width, cc.visibleRect.height, 0, 0);
(renderTexture.getSprite()).setAnchorPoint(cc.p(0.5, 0.5));
renderTexture.setPosition(cc.p(cc.visibleRect.width / 2, cc.visibleRect.height / 2));
renderTexture.setAnchorPoint(cc.p(0.5, 0.5));
var runningNode = cc.director.getRunningScene();
renderTexture.begin();
runningNode.visit();
renderTexture.end();
var ok = renderTexture.saveToFile(imgName, cc.IMAGE_FORMAT_JPEG, false);
if(!ok) return ok;
//jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "closeWeb", "()V");
var act = new cc.Sequence(new cc.DelayTime(0.1),new cc.CallFunc(function(){
if(callback){
var path = jsb.fileUtils.getWritablePath() + imgName;
callback(path);
}
},null,null));
runningNode.runAction(act);
return ok;
},
```
保存的图片是片白色的图,要怎么弄
请问楼主有解决么?怎么解决的?我遇到同样的问题。。