问题模块 | 框架类型 | 问题类型 | API/组件名称 | 终端类型 | 操作系统 | 微信版本 | 基础库版本 |
---|---|---|---|---|---|---|---|
API和组件 | 小程序 | Bug | wx.canvasPutImageData | iOS | 6.7 | 2.1.1 |
this .ctx.clearRect(0, 0, this .ctxW, this .ctxH) this .ctx.setFillStyle( 'black' ) this .ctx.fillRect(0, 0, this .ctxW, this .ctxH) // this.ctx.drawImage(src, 0, 0, dw, dh) this .ctx.draw() var newData = [] for ( var j=0;j<100;j++) { newData.push(255, 0, 0,1) } wx.canvasPutImageData({ canvasId: 'myCanvas' , x: 0, y: 10, width: 100, data: new Uint8ClampedArray(newData) }) |
经测试 canvasPutImageData时,无论指定的data像素数组中是什么,绘制出来的总是白色的线条,这是怎么回事?