canvas 生成图片 artTo 安卓下变形,ios 完好
发布于 5 年前 作者 ming96 4636 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

安卓下:

IOS下:

  • 预期表现

与IOS相同

  • 复现路径
  • 提供一个最简复现 Demo
2 回复

// 圆角矩形

export function drawRoundedRect(options) {

  let { ctx, x, y, r, width, height, color, shadow } = options

  ctx.save()

 

  if (shadow) {

    ctx.setShadow(0, 0, shadow.offset, shadow.color)

  }

  ctx.setFillStyle(color)

  ctx.beginPath()

  ctx.moveTo(x + r, y)

  ctx.arcTo(x + width, y, x + width, y + height, r)

  ctx.arcTo(x + width, y + height, x, y + height, r)

  ctx.arcTo(x, y + height, x, y, r)

  ctx.arcTo(x, y, x + width, y, r)

  ctx.closePath()

  ctx.fill()

  ctx.restore()

}

回到顶部