mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
e3e1db619f
* Revert "move in port/native to platforms/native (#7962)"
This reverts commit 96871ba26b.
* move port/native into platforms/native
37 lines
755 B
JavaScript
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;
|