同问
如何将ArrayBuffer 转换成 Uint8ClampedArray?- 需求的场景描述(希望解决的问题) 将云API生成的小程序二维码 arraybuffer 变成Uint8ClampedArray ,然后通过画布保存下来。 [代码]const data = [代码][代码]new[代码] [代码]Uint8ClampedArray([代码][代码]this[代码][代码].data.imageByteArray);[代码][代码] [代码][代码]wx.canvasPutImageData({[代码][代码] [代码][代码]canvasId: [代码][代码]'firstCanvas'[代码][代码],[代码][代码] [代码][代码]x: 0,[代码][代码] [代码][代码]y: 0,[代码][代码] [代码][代码]width: 308,[代码][代码] [代码][代码]height:308,[代码][代码] [代码][代码]data: data,[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]wx.canvasToTempFilePath({[代码][代码] [代码][代码]x: 0,[代码][代码] [代码][代码]y: 0,[代码][代码] [代码][代码]width: 308,[代码][代码] [代码][代码]height: 308,[代码][代码] [代码][代码]destWidth: 308,[代码][代码] [代码][代码]destHeight: 308,[代码][代码] [代码][代码]canvasId: [代码][代码]'firstCanvas'[代码][代码],[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]console.log(res.tempFilePath)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail(e){[代码][代码] [代码][代码]console.error(e);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码]- 希望提供的能力
2019-09-20