wx.canvasPutImageData 绘制出来始终是白色
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像素数组中是什么,绘制出来的总是白色的线条,这是怎么回事?