UNPKG

tav-media

Version:

Cross platform media editing framework

20 lines (19 loc) 600 B
export class ArrayBufferImage { constructor(buffer, width, height) { this.buffer = buffer; this._width = width; this._height = height; } width() { return this._width; } height() { return this._height; } upload(GL) { var _a; const gl = (_a = GL.currentContext) === null || _a === void 0 ? void 0 : _a.GLctx; gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this._width, this._height, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(this.buffer)); } }