[LayaAir 2.0]htmlCanvas.toBase64在iPhone上转换结果错误
代码就是下面这几行,在安卓机上显示正常,iPhone上第二个图片显示错误
附件里有完整工程
nButtonStart(){
var htmlCanvas = StageUI.instance.imageSp.drawToCanvas(200, 200, 0, 100); //截取精灵图片绘制到Canvas
var texture = htmlCanvas.getTexture(); //获取纹理
StageUI.instance.saveTexture.graphics.drawTexture(texture, 0, 0, 0, 0);//绘制截取到的纹理
//可以获得base64位图,用于保存或上传到服务器
StageUI.instance.saveBase64.texture = texture;
htmlCanvas.toBase64("png",0.8,this.getBase64);
}
getBase64(base64){
StageUI.instance.saveBase64.loadImage(base64);
}
附件里有完整工程
nButtonStart(){
var htmlCanvas = StageUI.instance.imageSp.drawToCanvas(200, 200, 0, 100); //截取精灵图片绘制到Canvas
var texture = htmlCanvas.getTexture(); //获取纹理
StageUI.instance.saveTexture.graphics.drawTexture(texture, 0, 0, 0, 0);//绘制截取到的纹理
//可以获得base64位图,用于保存或上传到服务器
StageUI.instance.saveBase64.texture = texture;
htmlCanvas.toBase64("png",0.8,this.getBase64);
}
getBase64(base64){
StageUI.instance.saveBase64.loadImage(base64);
}
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Aar0n
赞同来自: