canvas 画圆角矩形头像合成图片在ios是正常显示,在安卓显示有问题,在调试工具没问题,为什么?
发布于 5 年前 作者 chaofeng 6882 次浏览 来自 问答

1:是ios下载后显示

:2:是安卓下载后显示

let r = 24 * this.tempData.hsl,
      x = 40 * this.tempData.hsl,
      y = 162 * this.tempData.hsl,
      w = 640 * this.tempData.hsl,
      h = 796 * this.tempData.hsl;
     
    if (config.fileSite && config.BID) {
      my_carvas.save()
      if (w < 2 * r) r = w / 2
      if (h < 2 * r) r = h / 2
      my_carvas.beginPath()
      my_carvas.moveTo(x + r, y)
      my_carvas.arcTo(x + w, y, x + w, y + h, r)
      my_carvas.arcTo(x + w, y + h, x, y + h, r)
      my_carvas.arcTo(x, y + h, x, y, r)
      my_carvas.arcTo(x, y, x + w, y, r)
      my_carvas.closePath();
      my_carvas.clip()
      my_carvas.drawImage(this.data.imgPath, x, y, 640 * this.tempData.hsl, 796 * this.tempData.hsl);
      my_carvas.restore() // 返回上一状态
    }

这是画圆角矩形的代码,怎么解决

3 回复

遇到同样问题,有解决方法吗?

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

麻烦发下代码片段

回到顶部