Files
cocos4/platforms/native/builtin/jsb-adapter/ImageData.js
T
PP e3e1db619f move port/native into platforms/native (#7963)
* Revert "move in port/native to platforms/native (#7962)"

This reverts commit 96871ba26b.

* move port/native into platforms/native
2020-12-15 12:43:16 +08:00

37 lines
755 B
JavaScript

class ImageData {
// var imageData = new ImageData(array, width, height);
// var imageData = new ImageData(width, height);
constructor(array, width, height) {
if (typeof array === 'number' && typeof width == 'number') {
height = width;
width = array;
array = null;
}
if (array === null) {
this._data = new Uint8ClampedArray(width * height * 4);
}
else {
this._data = array;
}
this._width = width;
this._height = height;
}
get data() {
return this._data;
}
get width() {
return this._width;
}
get height() {
return this._height;
}
}
module.exports = ImageData;