微信小程序API 绘图stroke(对当前路径进行描边)


本文整理自网络,侵删。

绘图接口和方法

canvasContext.stroke


定义

画出当前路径的边框。默认颜色色为黑色。

Tip:stroke()描绘的的路径是从beginPath()开始计算,但是不会将strokeRect()包含进去,详情见例二。

例子

const ctx = wx.createCanvasContext('myCanvas')
ctx.moveTo(10, 10)
ctx.lineTo(100, 10)
ctx.lineTo(100, 100)
ctx.stroke()
ctx.draw()


const ctx = wx.createCanvasContext('myCanvas')
// begin path
ctx.rect(10, 10, 100, 30)
ctx.setStrokeStyle('yellow')
ctx.stroke()

// begin another path
ctx.beginPath()
ctx.rect(10, 40, 100, 30)

// only stoke this rect, not in current path
ctx.setStrokeStyle('blue')
ctx.strokeRect(10, 70, 100, 30)

ctx.rect(10, 100, 100, 30)

// it will stroke current path
ctx.setStrokeStyle('red')
ctx.stroke()
ctx.draw()


绘图接口和方法


标签:微信小程序

相关阅读 >>

微信小程序云开发服务端数据库api 指定筛选条件

微信小程序 小程序使用getquota

微信小程序api 实时音视频-创建liveplayercontext对象

微信小程序 框架扩展computed

微信小程序api 绘图fillrect(填充矩形)

sdk数据库 aggregate文档拆分

微信小程序 小程序搜索-优化指南

微信小程序云开发 api数据库更新记录

微信小程序api 视频解码器-videodecoder实例

微信小程序 wxss

更多相关阅读请进入《微信小程序》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...