import { CompressedTextureResource } from 'pixijs/compressed-textures'; import { BufferResource } from 'pixijs/core'; import { BASIS_FORMATS } from '../Basis'; import { TranscoderWorker } from '../TranscoderWorker'; import type { BasisBinding, BasisTextureExtensions } from '../Basis'; export declare type TranscodedResourcesArray = (Array | Array) & { basisFormat: BASIS_FORMATS; }; /** * Loader plugin for handling BASIS supercompressed texture files. * * To use this loader, you must bind the basis_universal WebAssembly transcoder. There are two ways of * doing this: * * 1. Adding a <script> tag to your HTML page to the transcoder bundle in this package, and serving * the WASM binary from the same location. * * ```html * * * ``` * * NOTE: `basis_transcoder.js` expects the WebAssembly binary to be named `basis_transcoder.wasm`. * NOTE-2: This method supports transcoding on the main-thread. Only use this if you have 1 or 2 *.basis * files. * * 2. Loading the transcoder source from a URL. * * ```js * // Use this if you to use the default CDN url for pixijs/basis * BasisParser.loadTranscoder(); * * // Use this if you want to serve the transcoder on your own * BasisParser.loadTranscoder('./basis_transcoder.js', './basis_transcoder.wasm'); * ``` * * NOTE: This can only be used with web-workers. * @class * @memberof PIXI * @implements {PIXI.ILoaderPlugin} */ export declare class BasisParser { static basisBinding: BasisBinding; private static defaultRGBFormat; private static defaultRGBAFormat; private static fallbackMode; private static workerPool; /** * Runs transcoding and populates {@link imageArray}. It will run the transcoding in a web worker * if they are available. * @private */ static transcode(arrayBuffer: ArrayBuffer): Promise; /** * Finds a suitable worker for transcoding and sends a transcoding request * @private * @async */ static transcodeAsync(arrayBuffer: ArrayBuffer): Promise; /** * Runs transcoding on the main thread. * @private */ static transcodeSync(arrayBuffer: ArrayBuffer): TranscodedResourcesArray; /** * Detects the available compressed texture formats on the device. * @param extensions - extensions provided by a WebGL context * @ignore */ static autoDetectFormats(extensions?: Partial): void; /** * Binds the basis_universal transcoder to decompress *.basis files. You must initialize the transcoder library yourself. * @example * import { BasisParser } from 'pixijs/basis'; * * // BASIS() returns a Promise-like object * globalThis.BASIS().then((basisLibrary) => * { * // Initialize basis-library; otherwise, transcoded results maybe corrupt! * basisLibrary.initializeBasis(); * * // Bind BasisParser to the transcoder * BasisParser.bindTranscoder(basisLibrary); * }); * @param basisLibrary - the initialized transcoder library * @private */ static bindTranscoder(basisLibrary: BasisBinding): void; /** * Loads the transcoder source code for use in {@link PIXI.BasisParser.TranscoderWorker}. * @private * @param jsURL - URL to the javascript basis transcoder * @param wasmURL - URL to the wasm basis transcoder */ static loadTranscoder(jsURL: string, wasmURL: string): Promise<[void, void]>; /** * Set the transcoder source code directly * @private * @param jsSource - source for the javascript basis transcoder * @param wasmSource - source for the wasm basis transcoder */ static setTranscoder(jsSource: string, wasmSource: ArrayBuffer): void; static TranscoderWorker: typeof TranscoderWorker; static get TRANSCODER_WORKER_POOL_LIMIT(): number; static set TRANSCODER_WORKER_POOL_LIMIT(limit: number); }