import { PAGSurface } from './pag-surface'; import { Matrix } from './core/matrix'; import { PAGComposition } from './pag-composition'; import type { PAGLayer } from './pag-layer'; import { type PAGScaleMode, type Rect, VecArray } from './types'; import type { VideoReader } from './interfaces'; import { VideoReaderManager } from "./video-reader-manager"; export declare class PAGPlayer { static create(): PAGPlayer; wasmIns: any; isDestroyed: boolean; videoReaders: VideoReader[]; protected pagComposition: PAGComposition | null; protected videoReaderManager: VideoReaderManager | null; constructor(wasmIns: any); /** * Set the progress of play position, the value is from 0.0 to 1.0. */ setProgress(progress: number): void; /** * Apply all pending changes to the target surface immediately. Returns true if the content has * changed. */ flush(): Promise; /** * [Internal] Apply all pending changes to the target surface immediately. Returns true if the content has * changed. */ flushInternal(callback: (res: boolean) => void): Promise; /** * The duration of current composition in microseconds. */ duration(): number; /** * Returns the current progress of play position, the value is from 0.0 to 1.0. */ getProgress(): number; /** * Returns the current frame. */ currentFrame(): number; /** * If set to false, the player skips rendering for video composition. */ videoEnabled(): boolean; /** * Set the value of videoEnabled property. */ setVideoEnabled(enabled: boolean): void; /** * If set to true, PAGPlayer caches an internal bitmap representation of the static content for each * layer. This caching can increase performance for layers that contain complex vector content. The * execution speed can be significantly faster depending on the complexity of the content, but it * requires extra graphics memory. The default value is true. */ cacheEnabled(): boolean; /** * Set the value of cacheEnabled property. */ setCacheEnabled(enabled: boolean): void; /** * This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0. The * scale factors less than 1.0 may result in blurred output, but it can reduce the usage of graphics * memory which leads to better performance. The default value is 1.0. */ cacheScale(): number; /** * Set the value of cacheScale property. */ setCacheScale(value: number): void; /** * The maximum frame rate for rendering, ranges from 1 to 60. If set to a value less than the actual * frame rate from composition, it drops frames but increases performance. Otherwise, it has no * effect. The default value is 60. */ maxFrameRate(): number; /** * Set the maximum frame rate for rendering. */ setMaxFrameRate(value: number): void; /** * Returns the current scale mode. */ scaleMode(): PAGScaleMode; /** * Specifies the rule of how to scale the pag content to fit the surface size. The matrix * changes when this method is called. */ setScaleMode(value: PAGScaleMode): void; /** * Set the PAGSurface object for PAGPlayer to render onto. */ setSurface(pagSurface: PAGSurface | null): void; /** * * Returns the current PAGComposition for PAGPlayer to render as content. */ getComposition(): PAGComposition; /** * * Sets a new PAGComposition for PAGPlayer to render as content. */ setComposition(pagComposition: PAGComposition | null): void; /** * Returns the PAGSurface object for PAGPlayer to render onto. */ getSurface(): PAGSurface; /** * Returns a copy of current matrix. */ matrix(): Matrix; /** * Set the transformation which will be applied to the composition. The scaleMode property * will be set to PAGScaleMode::None when this method is called. */ setMatrix(matrix: Matrix): void; /** * Set the progress of play position to next frame. It is applied only when the composition is not * null. */ nextFrame(): void; /** * Set the progress of play position to previous frame. It is applied only when the composition is * not null. */ preFrame(): void; /** * If true, PAGPlayer clears the whole content of PAGSurface before drawing anything new to it. * The default value is true. */ autoClear(): boolean; /** * Sets the autoClear property. */ setAutoClear(value: boolean): void; /** * Returns a rectangle that defines the original area of the layer, which is not transformed by * the matrix. */ getBounds(pagLayer: PAGLayer): Rect; /** * Returns an array of layers that lie under the specified point. The point is in pixels and from * * this PAGComposition's local coordinates. */ getLayersUnderPoint(localX: number, localY: number): VecArray; /** * Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point * * is in the coordinate space of the PAGSurface, not the PAGComposition that contains the * PAGLayer. It always returns false if the PAGLayer or its parent (or parent's parent...) has not * been added to this PAGPlayer. The pixelHitTest parameter indicates whether or not to check * against the actual pixels of the object (true) or the bounding box (false). Returns true if the * PAGLayer overlaps or intersects with the specified point. */ hitTestPoint(pagLayer: PAGLayer, surfaceX: number, surfaceY: number, pixelHitTest?: boolean): boolean; /** * The time cost by rendering in microseconds. */ renderingTime(): number; /** * The time cost by image decoding in microseconds. */ imageDecodingTime(): number; /** * The time cost by presenting in microseconds. */ presentingTime(): number; /** * The memory cost by graphics in bytes. */ graphicsMemory(): number; /** * Prepares the player for the next flush() call. It collects all CPU tasks from the current * progress of the composition and runs them asynchronously in parallel. It is usually used for * speeding up the first frame rendering. */ prepare(): Promise; destroy(): void; /** * Link VideoReader to PAGPlayer. */ linkVideoReader(videoReader: VideoReader): void; /** * Unlink VideoReader from PAGPlayer. */ unlinkVideoReader(videoReader: VideoReader): void; /** * Prepares the video frame for the current composition before rendering. */ private prepareVideoFrame; /** * Destroys the video reader manager and releases all associated resources. */ destroyVideoReaderManager(): void; }