javascript ImageData typed array read whole pixel?

前端 未结 2 2216
醉话见心
醉话见心 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!
    
    0 讨论(0)
  • 2021-02-14 05:54

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

    0 讨论(0)
提交回复
热议问题