获得过 0 次赞
回答过的问题获得 0 次赞
分享过的文章/案例获得 0 次赞
评论与回复获得 0 次赞
@官方
为啥使用canvas绘制完成后会出现黑色边框?为啥使用canvas绘制完成后会出现黑色边框[图片] 代码: <canvas type="2d" id="canvasChessBoard"></canvas> const query = wx.createSelectorQuery() query.select('#canvasChessBoard') .fields({ node: true, size: true }) .exec((res) => { const canvas = res[0].node const ctx = canvas.getContext('2d') // ctx.drawImage(dataTemp.strPathImgChessboard, 0, 0, dataTemp.nCanvChessBoardWidth, dataTemp.nCanvChessBoardHeight) const dpr = wx.getSystemInfoSync().pixelRatio canvas.width = res[0].width * dpr canvas.height = res[0].height * dpr ctx.scale(dpr, dpr) ctx.fillRect(0, 0, 100, 100) })
2022-05-20