警告:
HTML Canvas2D:设置willReadFrequently属性为true可加快多个getImageData读取操作的速度
HTML Canvas2D中的willReadFrequently属性是一个布尔值,用于控制是否将图像数据缓存在GPU内存中,当设置为true时,浏览器会尽量将图像数据缓存在GPU内存中,从而提高多个getImageData读取操作的速度。
const ctx = canvas.getContext('2d', {willReadFrequently: true});