javascript ImageData typed array read whole pixel?

为君一笑 提交于 2019-12-03 12:36:51

figured it out, i need to pass the buffer itself into the Uint32Array constructor, not another BufferView.

var buf32 = new Uint32Array(imgd.data.buffer);
console.log(buf32.length)  // 64 yay!

the buffer length is increased four times because of the retina display, you have to write pixelDensity(1); to avoid this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!