- 当前 Bug 的表现(可附上截图)
用安卓真机调试和真机保存图片到相册时,使用canvasToTempFilePath生成图片会导致canvas里的像素乱掉,导致生成的二维码出现问题不能识别,下面是一个比较简单的像素生成, 图片像素越复杂出现问题的几率越高
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
download() { const ctx = wx.createCanvasContext( 'test' ); let count = 29, width = 130 / count, height = 130 / count; for (let row = 0; row < count; row++) { for (let col = 0; col < count; col++) { let isDark = row%2 == 1 && col%2 == 1, left = col * width, top = row * height; ctx.setFillStyle(isDark ? '#000000' : '#FFFFFF' ); ctx.fillRect(left, top, width, height); } } ctx.draw( false , () => { wx.canvasToTempFilePath({ x: 0, y: 0, width: 300, height: 300, destWidth: 300, destHeight: 300, canvasId: 'test' , success(res) { wx.saveImageToPhotosAlbum({ filePath: res.tempFilePath, }) }, }) }) } |
你好,麻烦提供这种格式的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
https://developers.weixin.qq.com/s/DujlSimx7W9d,开发者工具和ios没有问题,安卓的会有问题
请问这个问题有结论了吗
你好,有进展会在此帖回复你哈
这里可以先了解一下新的canvas:小程序新 Canvas 接口公测? - 微信开放社区 https://developers.weixin.qq.com/community/develop/doc/00020a02c2c040114d19a398f5b001
用画布生成二维码也是厉害了