type Video = HTMLVideoElement; /** Who draws a texture: called when it has new pixels. */ type User = () => void; /** The texture of a media element, and what is known of it. */ export interface Texture { key: string | Video; /** Who draws it, and when they asked for it last: a count. */ users: Map; /** Width it was asked for at last, px. */ asked: number; /** Says when there is another texture. */ version: number; texture?: GPUTexture; view?: GPUTextureView; ready?: boolean; failed?: 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 device Device. * @param sampler Sampler that takes the mean of pixels. * @return `get( user, media, width, maxSize )`, `sweep( user )`, * `free( user )`. */ export declare function createTextures(device: GPUDevice, sampler: GPUSampler): { /** * The texture of a media element. * * @param user Who asks: called when the texture has * new pixels. * @param media Image or video. * @param width Width the whole image is drawn at, in * device pixels. * @param maxSize Largest side of a texture. * @return `view`, `version`; null while there is none. */ get: (user: User, media: HTMLElement, width: number, maxSize: number) => Texture | null; /** * Lets go of all but the `KEEP` textures a user asked for last. * * @param user Who draws. */ sweep(user: User): void; /** * @param user Who no longer draws. */ free(user: User): void; }; export {};