createOffscreenCanvas 如何使用?canvasToTempFilePath报错
1、使用离屏 定义如下 const canvas = wx.createOffscreenCanvas({
type: '2d',
width: canvasWidth,
height: canvasHeight
})
const canvasCtx = canvas.getContext('2d')
2、顺利生成 let res = canvasCtx.createImageData(canvasWidth,canvasHeight)
(一点也不顺利的 结果 ) res 的 值{data: Uint8ClampedArray(1216500), width: 375, height: 811, dataUnion: Uint8ClampedArray(1216500)}
3、问题1 我要怎么用这个数据呢? 4、也无法存下图片,这一步报错 wx.canvasToTempFilePath({
x: 0,
y: 0,
width: canvasWidth,
height: canvasHeight,
destWidth: canvasWidth,
destHeight: canvasHeight,
canvas: canvas,
success(res) {
console.log(res.tempFilePath)
}
})
wx.canvasToTempFilePath 这一步的报错信息如下 VM282 WAService.js:2 TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)'