import { DebugData, PAGScaleMode, PAGViewEventMap } from './types';
import { PAGPlayer } from './pag-player';
import { EventManager, Listener } from './utils/event-manager';
import { PAGSurface } from './pag-surface';
import { BackendContext } from './core/backend-context';
import { RenderCanvas } from './core/render-canvas';
import type { PAGComposition } from './pag-composition';
import type { Matrix } from './core/matrix';
export interface PAGViewOptions {
    /**
     * Use style to scale canvas. default false.
     * When target canvas is offscreen canvas, useScale is false.
     */
    useScale?: boolean;
    /**
     * Can choose Canvas2D mode in chrome. default false.
     */
    useCanvas2D?: boolean;
    /**
     * Render first frame when pag view init. default true.
     */
    firstFrame?: boolean;
}
export declare class PAGView {
    /**
     * Create pag view.
     * @param file pag file.
     * @param canvas target render canvas.
     * @param initOptions pag view options
     * @returns
     */
    static init(file: PAGComposition, canvas: string | HTMLCanvasElement | OffscreenCanvas, initOptions?: PAGViewOptions): Promise<PAGView | undefined>;
    protected static makePAGSurface(pagGlContext: BackendContext, width: number, height: number): PAGSurface;
    /**
     * The repeat count of player.
     */
    repeatCount: number;
    /**
     * Indicates whether or not this pag view is playing.
     */
    isPlaying: boolean;
    /**
     * Indicates whether or not this pag view is destroyed.
     */
    isDestroyed: boolean;
    protected pagViewOptions: PAGViewOptions;
    protected renderCanvas: RenderCanvas | null;
    protected pagGlContext: BackendContext | null;
    protected frameRate: number;
    protected pagSurface: PAGSurface | null;
    protected player: PAGPlayer;
    protected playFrame: number;
    protected canvasElement: HTMLCanvasElement | OffscreenCanvas | null;
    protected timer: number | null;
    protected flushingNextFrame: boolean;
    protected playTime: number;
    protected startTime: number;
    protected repeatedTimes: number;
    protected eventManager: EventManager<PAGViewEventMap, PAGView>;
    private canvasContext;
    private rawWidth;
    private rawHeight;
    private debugData;
    private fpsBuffer;
    constructor(pagPlayer: PAGPlayer, canvasElement: HTMLCanvasElement | OffscreenCanvas);
    /**
     * The duration of current composition in microseconds.
     */
    duration(): number;
    /**
     * Adds a listener to the set of listeners that are sent events through the life of an animation,
     * such as start, repeat, and end.
     */
    addListener<K extends keyof PAGViewEventMap>(eventName: K, listener: Listener<PAGViewEventMap[K]>): void;
    /**
     * Removes a listener from the set listening to this animation.
     */
    removeListener<K extends keyof PAGViewEventMap>(eventName: K, listener?: Listener<PAGViewEventMap[K]>): boolean;
    /**
     * Start the animation.
     */
    play(): Promise<void>;
    /**
     * Pause the animation.
     */
    pause(): void;
    /**
     * Stop the animation.
     */
    stop(notification?: boolean): Promise<void>;
    /**
     * Set the number of times the animation will repeat. The default is 1, which means the animation
     * will play only once. 0 means the animation will play infinity times.
     */
    setRepeatCount(repeatCount: number): void;
    /**
     * Returns the current progress of play position, the value is from 0.0 to 1.0. It is applied only
     * when the composition is not null.
     */
    getProgress(): number;
    /**
     * Returns the current frame.
     */
    currentFrame(): number;
    /**
     * Set the progress of play position, the value is from 0.0 to 1.0.
     */
    setProgress(progress: number): number;
    /**
     * Return the value of videoEnabled property.
     */
    videoEnabled(): boolean;
    /**
     * If set false, will skip video layer drawing.
     */
    setVideoEnabled(enable: boolean): void;
    /**
     * If set to true, PAG renderer 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(enable: 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. If set to a value less than the actual frame rate from
     * PAGFile, 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;
    /**
     * Call this method to render current position immediately. If the play() method is already
     * called, there is no need to call it. Returns true if the content has changed.
     */
    flush(): Promise<boolean>;
    /**
     * Free the cache created by the pag view immediately. Can be called to reduce memory pressure.
     */
    freeCache(): void;
    /**
     * Returns the current PAGComposition for PAGView to render as content.
     */
    getComposition(): PAGComposition;
    /**
     * Sets a new PAGComposition for PAGView to render as content.
     * Note: If the composition is already added to another PAGView, it will be removed from
     * the previous PAGView.
     */
    setComposition(pagComposition: PAGComposition): void;
    /**
     * 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;
    getLayersUnderPoint(localX: number, localY: number): import("./types").Vector<import("./pag-image-layer").PAGImageLayer | import("./pag-layer").PAGLayer | import("./pag-solid-layer").PAGSolidLayer | import("./pag-text-layer").PAGTextLayer>;
    /**
     * Update size when changed canvas size.
     */
    updateSize(): void;
    /**
     * 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<void>;
    /**
     * Returns a ImageBitmap object capturing the contents of the PAGView. Subsequent rendering of
     * the PAGView will not be captured. Returns null if the PAGView hasn't been presented yet.
     */
    makeSnapshot(): Promise<ImageBitmap>;
    destroy(): void;
    getDebugData(): DebugData;
    setDebugData(data: DebugData): void;
    protected flushLoop(force?: boolean): Promise<void>;
    protected flushNextFrame(force?: boolean): Promise<boolean>;
    protected getNowTime(): number;
    protected clearTimer(): void;
    protected resetSize(useScale?: boolean): void;
    private updateFPS;
    private needResetStartTime;
    private setTimer;
}
