canvas

发布于 8 年前作者 mingshen13345 次浏览最后编辑 8 年前来自 ask

下面一段代码是把ctx.drawImage()封装成一个方法:

statusImage: function (picPath, statusImgObj) {
var ctx = this.data.ctx;
   ctx.drawImage(picPath, (statusImgObj.x-50) / 2, (statusImgObj.y -16)/ 2,50, 50)
},

在需要的地方调用这个方法:

that.statusImage(item.imgUrl, {x: item.x, y: item.y});
that.data.ctx.draw();

真机上测试时,发现用ctx.drawImage()画的静态图片在安卓机上被拉伸变虚,ios系统没有被拉伸变虚

0 回复
暂无回复