samizdatco / skia-canvas

A GPU-accelerated 2D graphics environment for Node.js
MIT License
1.7k stars 66 forks source link

ImageData constructor does not match specification #74

Closed WilliamDASILVA closed 2 years ago

WilliamDASILVA commented 2 years ago

Hello,

The ImageData class does not match the current ImageData constructor. The data and width/height are reverted in this version compared to https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData. The typing is correct (because its extending Node's ImageData) but here its incorrect.

See https://github.com/samizdatco/skia-canvas/blob/main/lib/index.js#L585

Due to this error, it causes the ImageData dimensions must be positive integers error because the dataArray is passed as first argument.

samizdatco commented 2 years ago

You're quite right. Thanks for the heads-up!