import { TextureSourceType } from './types'; import type { TextureFactorySourceFrom, TextureSourceOptions, TextureDataType, TextureOptionsBase } from './types'; import type { Engine } from '../engine'; import { EffectsObject } from '../effects-object'; /** * Texture 抽象类 */ export declare abstract class Texture extends EffectsObject { /** * Texture 名称 */ name: string; sourceFrom?: TextureFactorySourceFrom; sourceType?: TextureSourceType; source: TextureSourceOptions; /** * Texture 高度 */ width: number; /** * Texture 宽度 */ height: number; /** * Texture 的全局唯一 id */ readonly id: string; protected destroyed: boolean; protected offloaded: boolean; /** * 创建一个新的 Texture 对象。 */ static create: (engine: Engine, options?: TextureSourceOptions) => Texture; /** * 通过 URL 创建 Texture 对象。 * @param url - 要创建的 Texture URL * @since 2.0.0 */ static fromImage(url: string, engine: Engine, options?: TextureOptionsBase): Promise; /** * 通过视频 URL 创建 Texture 对象。 * @param url - 要创建的 Texture URL * @param engine - 引擎对象 * @param options - 可选的 Texture 选项 * @since 2.1.0 * @returns */ static fromVideo(url: string, engine: Engine, options?: TextureOptionsBase): Promise; /** * 通过数据创建 Texture 对象。 * @param data - 要创建的 Texture 数据 * @param options - 可选的 Texture 选项 */ static createWithData: (engine: Engine, data?: TextureDataType, options?: Record) => Texture; constructor(engine: Engine); get isDestroyed(): boolean; /** * 获取 Texture 的宽度。 */ getWidth(): number; /** * 获取 Texture 的高度。 */ getHeight(): number; uploadCurrentVideoFrame(): void; /** * 释放 Texture GPU 资源。 * 注意:该方法只释放资源,并不销毁 GPU textureBuffer 对象。 * @override */ offloadData(): void; /** * 重新加载 Texture GPU 资源。 * @override */ reloadData(): void; /** * 更新 Texture 源数据。 * @param options - 创建 Texture 选项 */ abstract updateSource(options: TextureSourceOptions): void; /** * 初始化 GPU 资源 * @override */ initialize(): void; protected assembleOptions(options: TextureSourceOptions): TextureSourceOptions; } export declare function generateHalfFloatTexture(engine: Engine, data: Uint16Array, width: number, height: number): Texture; export declare function generateWhiteTexture(engine: Engine): Texture; export declare function generateTransparentTexture(engine: Engine): Texture;