UNPKG

1.47 kBTypeScriptView Raw
1import { Resource } from './Resource';
2import type { ISize } from '@pixi/math';
3import type { Renderer } from '../../Renderer';
4import type { BaseTexture } from '../BaseTexture';
5import type { GLTexture } from '../GLTexture';
6/**
7 * Buffer resource with data of typed array.
8 * @memberof PIXI
9 */
10export declare class BufferResource extends Resource {
11 /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */
12 data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;
13 /**
14 * @param source - Source buffer
15 * @param options - Options
16 * @param {number} options.width - Width of the texture
17 * @param {number} options.height - Height of the texture
18 */
19 constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize);
20 /**
21 * Upload the texture to the GPU.
22 * @param renderer - Upload to the renderer
23 * @param baseTexture - Reference to parent texture
24 * @param glTexture - glTexture
25 * @returns - true is success
26 */
27 upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;
28 /** Destroy and don't use after this. */
29 dispose(): void;
30 /**
31 * Used to auto-detect the type of resource.
32 * @param {*} source - The source object
33 * @returns {boolean} `true` if \<canvas\>
34 */
35 static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array;
36}