/** * The textures of the media elements. * * Images are decoded and scaled off the main thread, uploaded once at the * size they are drawn at, with mipmaps. Slides that show the same file * share one texture. * * Videos are uploaded when they have a new frame, and only while something * asks for them. */ /** The texture of a media element, and what is known of it. */ export interface Texture { texture: WebGLTexture; ready: boolean; failed: boolean; /** Width it was uploaded at, px. */ width: number; /** Width it was asked for at last, px. */ asked: number; /** When it was asked for at last: a count. */ used?: number; /** Let go of, while it was loading. */ gone?: boolean; /** How often the picture came empty. */ tries?: number; /** A video has a frame that is not uploaded yet. */ fresh?: boolean; /** A video waits for its next frame. */ armed?: boolean; } /** * @param gl Context. * @param options Options. * @param options.maxSize Largest side of a texture. * @param options.changed Called when a texture has * new pixels. * @return `get( media, width )`, `destroy()`. */ export declare function createTextures(gl: WebGL2RenderingContext, { maxSize, changed }: { maxSize: number; changed: () => void; }): { /** * The texture of a media element. * * @param media Image or video. * @param width Width the whole image is drawn at, in * device pixels. * @return `texture`; null while there is none. */ get: (media: HTMLElement, width: number) => Texture | null; /** Lets go of all but the `KEEP` textures asked for last. */ sweep(): void; destroy(): void; };