javascript ImageData typed array read whole pixel?

前端 未结 2 2208
醉话见心
醉话见心 2021-02-14 05:29

So there is are a lot of examples on how to write an entire pixel from a Uint32Array view of the ImageData object. But is it possible to read an entire pixel without in

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-14 05:34

    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!
    

提交回复
热议问题