/// <reference types="emscripten" />
/// <reference types="offscreencanvas" />
import { PAGFile } from './pag-file';
import { PAGImage } from './pag-image';
import { PAGSurface } from './pag-surface';
import { WebAssemblyQueue } from './utils/queue';
import { PAGView } from './pag-view';
import { PAGFont } from './pag-font';
import { PAGPlayer } from './pag-player';
import { PAGLayer } from './pag-layer';
import { PAGComposition } from './pag-composition';
import { PAGTextLayer } from './pag-text-layer';
import { GlobalCanvas } from './core/global-canvas';
import { BackendContext } from './core/backend-context';
import { PAGImageLayer } from './pag-image-layer';
import { PAGSolidLayer } from './pag-solid-layer';
import { Matrix as ClassMatrix } from './core/matrix';
import { RenderCanvas } from './core/render-canvas';
import type { NativeImage, NativeImageConstructor, ScalerContextConstructor, VideoDecoderConstructor, WebMaskConstructor } from './interfaces';
declare global {
    interface Window {
        WeixinJSBridge?: any;
    }
}
export interface PAG extends EmscriptenModule {
    _PAGFile: {
        _Load: (bytes: number, length: number) => any;
        _MaxSupportedTagLevel: () => number;
    };
    _PAGImage: {
        _FromNativeImage: (nativeImage: NativeImage) => any;
        _FromPixels: (pixels: number, width: number, height: number, rowBytes: number, colorType: ColorType, alphaType: AlphaType) => any;
        _FromTexture: (textureID: number, width: number, height: number, flipY: boolean) => any;
    };
    _PAGPlayer: any;
    _PAGSurface: {
        _FromCanvas: (canvasID: string) => any;
        _FromTexture: (textureID: number, width: number, height: number, flipY: boolean) => any;
        _FromRenderTarget: (framebufferID: number, width: number, height: number, flipY: boolean) => any;
    };
    _PAGComposition: {
        _Make: (width: number, height: number) => any;
    };
    _PAGTextLayer: {
        _Make: ((duration: number, text: string, fontSize: number, fontFamily: string, fontStyle: string) => any) & ((duration: number, textDocumentHandle: TextDocument) => any);
    };
    _PAGImageLayer: {
        _Make: (width: number, height: number, duration: number) => any;
    };
    _PAGSolidLayer: {
        _Make: (duration: number, width: number, height: number, solidColor: Color, opacity: number) => any;
    };
    _PAGFont: {
        _create: (fontFamily: string, fontStyle: string) => any;
        _SetFallbackFontNames: (fontName: any) => void;
    };
    _Matrix: {
        _MakeAll: (scaleX: number, skewX: number, transX: number, skewY: number, scaleY: number, transY: number, pers0: number, pers1: number, pers2: number) => any;
        _MakeScale: ((sx: number, sy: number) => any) & ((scale: number) => any);
        _MakeTrans: (dx: number, dy: number) => any;
    };
    _registerSoftwareDecoderFactory: (factory: SoftwareDecoderFactory | null) => void;
    VectorString: any;
    webAssemblyQueue: WebAssemblyQueue;
    GL: EmscriptenGL;
    TGFXPathFillType: TGFXPathFillType;
    TGFXLineCap: TGFXLineCap;
    TGFXLineJoin: TGFXLineJoin;
    globalCanvas: GlobalCanvas;
    PAG: PAG;
    PAGPlayer: typeof PAGPlayer;
    PAGFile: typeof PAGFile;
    PAGView: typeof PAGView;
    PAGFont: typeof PAGFont;
    PAGImage: typeof PAGImage;
    PAGLayer: typeof PAGLayer;
    PAGComposition: typeof PAGComposition;
    PAGSurface: typeof PAGSurface;
    PAGTextLayer: typeof PAGTextLayer;
    PAGImageLayer: typeof PAGImageLayer;
    PAGSolidLayer: typeof PAGSolidLayer;
    NativeImage: NativeImageConstructor;
    WebMask: WebMaskConstructor;
    ScalerContext: ScalerContextConstructor;
    VideoReader: VideoDecoderConstructor;
    GlobalCanvas: typeof GlobalCanvas;
    BackendContext: typeof BackendContext;
    Matrix: typeof ClassMatrix;
    RenderCanvas: typeof RenderCanvas;
    traceImage: (info: {
        width: number;
        height: number;
    }, pixels: Uint8Array, tag: string) => void;
    registerSoftwareDecoderFactory: (factory: SoftwareDecoderFactory | null) => void;
    SDKVersion: () => string;
    [key: string]: any;
}
export interface EmscriptenGL {
    contexts: (EmscriptenGLContext | null)[];
    createContext: (canvas: HTMLCanvasElement | OffscreenCanvas, webGLContextAttributes: EmscriptenGLContextAttributes) => number;
    currentContext?: EmscriptenGLContext;
    deleteContext: (contextHandle: number) => void;
    framebuffers: (WebGLFramebuffer | null)[];
    getContext: (contextHandle: number) => EmscriptenGLContext;
    getNewId: (array: any[]) => number;
    makeContextCurrent: (contextHandle: number) => boolean;
    registerContext: (ctx: WebGLRenderingContext, webGLContextAttributes: EmscriptenGLContextAttributes) => number;
    textures: (WebGLTexture | null)[];
}
export interface EmscriptenGLContext {
    handle: number;
    GLctx: WebGLRenderingContext;
    attributes: EmscriptenGLContextAttributes;
    initExtensionsDone: boolean;
    version: number;
}
export declare type EmscriptenGLContextAttributes = {
    majorVersion: number;
    minorVersion: number;
} & WebGLContextAttributes;
/**
 * Defines the rules on how to scale the content to fit the specified area.
 */
export declare const enum PAGScaleMode {
    /**
     * The content is not scaled.
     */
    None = 0,
    /**
     * The content is stretched to fit.
     */
    Stretch = 1,
    /**
     * The content is scaled with respect to the original unscaled image's aspect ratio.
     * This is the default value.
     */
    LetterBox = 2,
    /**
     * The content is scaled to fit with respect to the original unscaled image's aspect ratio.
     * This results in cropping on one axis.
     */
    Zoom = 3
}
export declare const enum PAGViewListenerEvent {
    /**
     * Notifies the start of the animation.
     */
    onAnimationStart = "onAnimationStart",
    /**
     * Notifies the end of the animation.
     */
    onAnimationEnd = "onAnimationEnd",
    /**
     * Notifies the cancellation of the animation.
     */
    onAnimationCancel = "onAnimationCancel",
    /**
     * Notifies the repetition of the animation.
     */
    onAnimationRepeat = "onAnimationRepeat",
    /**
     * Notifies the update of the animation.
     */
    onAnimationUpdate = "onAnimationUpdate",
    /**
     * Notifies the play of the animation.
     */
    onAnimationPlay = "onAnimationPlay",
    /**
     * Notifies the pause of the animation.
     */
    onAnimationPause = "onAnimationPause",
    /**
     * Notifies the flushed of the animation.
     */
    onAnimationFlushed = "onAnimationFlushed"
}
export declare const enum ParagraphJustification {
    LeftJustify = 0,
    CenterJustify = 1,
    RightJustify = 2,
    FullJustifyLastLineLeft = 3,
    FullJustifyLastLineRight = 4,
    FullJustifyLastLineCenter = 5,
    FullJustifyLastLineFull = 6
}
export declare const enum TextDirection {
    Default = 0,
    Horizontal = 1,
    Vertical = 2
}
/**
 * Layers are always one of the following types.
 */
export declare const enum LayerType {
    Unknown = 0,
    Null = 1,
    Solid = 2,
    Text = 3,
    Shape = 4,
    Image = 5,
    PreCompose = 6
}
/**
 * Defines the rules on how to stretch the timeline of content to fit the specified duration.
 */
export declare const enum PAGTimeStretchMode {
    /**
     * Keep the original playing speed, and display the last frame if the content's duration is less
     * than target duration.
     */
    None = 0,
    Scale = 1,
    /**
     * Keep the original playing speed, but repeat the content if the content's duration is less than
     * target duration. This is the default mode.
     */
    Repeat = 2,
    /**
     * Keep the original playing speed, but repeat the content in reversed if the content's duration
     * is less than target duration.
     */
    RepeatInverted = 3
}
export declare const enum MatrixIndex {
    a = 0,
    c = 1,
    tx = 2,
    b = 3,
    d = 4,
    ty = 5,
    pers0 = 6,
    pers1 = 7,
    pers2 = 8
}
export declare const enum DecoderResult {
    /**
     * The calling is successful.
     */
    Success = 0,
    /**
     * Output is not available in this state, need more input buffers.
     */
    TryAgainLater = -1,
    /**
     * The calling fails.
     */
    Error = -2
}
/**
 * Describes how pixel bits encode color. These values match up with the enum in Bitmap.Config on
 * Android platform.
 */
export declare const enum ColorType {
    /**
     * uninitialized.
     */
    Unknown = 0,
    /**
     * Each pixel is stored as a single translucency (alpha) channel. This is very useful to
     * efficiently store masks for instance. No color information is stored. With this configuration,
     * each pixel requires 1 byte of memory.
     */
    ALPHA_8 = 1,
    /**
     * Each pixel is stored on 4 bytes. Each channel (RGB and alpha for translucency) is stored with 8
     * bits of precision (256 possible values). The channel order is: red, green, blue, alpha.
     */
    RGBA_8888 = 2,
    /**
     * Each pixel is stored on 4 bytes. Each channel (RGB and alpha for translucency) is stored with 8
     * bits of precision (256 possible values). The channel order is: blue, green, red, alpha.
     */
    BGRA_8888 = 3
}
/**
 * Describes how to interpret the alpha component of a pixel.
 */
export declare const enum AlphaType {
    /**
     * uninitialized.
     */
    Unknown = 0,
    /**
     * pixel is opaque.
     */
    Opaque = 1,
    /**
     * pixel components are premultiplied by alpha.
     */
    Premultiplied = 2,
    /**
     * pixel components are independent of alpha.
     */
    Unpremultiplied = 3
}
export interface Point {
    x: number;
    y: number;
}
/**
 * Marker stores comments and other metadata and mark important times in a composition or layer.
 */
export interface Marker {
    startTime: number;
    duration: number;
    comment: string;
}
export interface Color {
    red: number;
    green: number;
    blue: number;
}
export interface ctor {
    value: number;
}
export interface TGFXPathFillType {
    /**
     * Enclosed by a non-zero sum of contour directions.
     */
    Winding: ctor;
    /**
     * Enclosed by an odd number of contours.
     */
    EvenOdd: ctor;
    /**
     * Enclosed by a zero sum of contour directions.
     */
    InverseWinding: ctor;
    /**
     * Enclosed by an even number of contours.
     */
    InverseEvenOdd: ctor;
}
export interface TGFXLineCap {
    /**
     * No stroke extension.
     */
    Butt: ctor;
    /**
     * Adds circle
     */
    Round: ctor;
    /**
     * Adds square
     */
    Square: ctor;
}
export interface TGFXLineJoin {
    /**
     * Extends to miter limit.
     */
    Miter: ctor;
    /**
     * Adds circle.
     */
    Round: ctor;
    /**
     * Connects outside edges.
     */
    Bevel: ctor;
}
export interface YUVBuffer {
    data: number[];
    lineSize: number[];
}
export interface DebugData {
    FPS?: number;
    flushTime?: number;
}
export declare class Matrix {
    /**
     * The entry at position [1,1] in the matrix.
     */
    a: number;
    /**
     * The entry at position [1,2] in the matrix.
     */
    b: number;
    /**
     * The entry at position [2,1] in the matrix.
     */
    c: number;
    /**
     * The entry at position [2,2] in the matrix.
     */
    d: number;
    /**
     * The entry at position [3,1] in the matrix.
     */
    tx: number;
    /**
     * The entry at position [3,2] in the matrix.
     */
    ty: number;
    /**
     * Sets Matrix value.
     */
    set: (index: number, value: number) => {};
    setAffine: (a: number, b: number, c: number, d: number, tx: number, ty: number) => {};
    private constructor();
}
export declare class Rect {
    /**
     * smaller x-axis bounds.
     */
    left: number;
    /**
     * smaller y-axis bounds.
     */
    top: number;
    /**
     * larger x-axis bounds.
     */
    right: number;
    /**
     * larger y-axis bounds.
     */
    bottom: number;
    private constructor();
}
export declare class TextDocument {
    /**
     * When true, the text layer shows a fill.
     */
    applyFill: boolean;
    /**
     * When true, the text layer shows a stroke.
     */
    applyStroke: boolean;
    baselineShift: number;
    /**
     * When true, the text layer is paragraph (bounded) text.
     */
    boxText: boolean;
    boxTextPos: Readonly<Point>;
    /**
     * For box text, the pixel dimensions for the text bounds.
     */
    boxTextSize: Readonly<Point>;
    firstBaseLine: number;
    fauxBold: boolean;
    fauxItalic: boolean;
    /**
     * The text layer’s fill color.
     */
    fillColor: Readonly<Color>;
    /**
     * A string with the name of the font family.
     **/
    fontFamily: string;
    /**
     * A string with the style information — e.g., “bold”, “italic”.
     **/
    fontStyle: string;
    /**
     * The text layer’s font size in pixels.
     */
    fontSize: number;
    /**
     * The text layer’s stroke color.
     */
    strokeColor: Readonly<Color>;
    /**
     * Indicates the rendering order for the fill and stroke of a text layer.
     */
    strokeOverFill: boolean;
    /**
     * The text layer’s stroke thickness.
     */
    strokeWidth: number;
    /**
     * The text layer’s Source Text value.
     */
    text: string;
    /**
     * The paragraph justification for the text layer.
     */
    justification: ParagraphJustification;
    /**
     * The space between lines, 0 indicates 'auto', which is fontSize * 1.2
     */
    leading: number;
    /**
     * The text layer’s spacing between characters.
     */
    tracking: number;
    /**
     *  The text layer’s background color
     */
    backgroundColor: Readonly<Color>;
    /**
     *  The text layer’s background alpha. 0 = 100% transparent, 255 = 100% opaque.
     */
    backgroundAlpha: number;
    direction: TextDirection;
    private constructor();
}
export declare class PAGVideoRange {
    private constructor();
    /**
     * The start time of the source video, in microseconds.
     */
    startTime(): number;
    /**
     * The end time of the source video (not included), in microseconds.
     */
    endTime(): number;
    /**
     * The duration for playing after applying speed.
     */
    playDuration(): number;
    /**
     * Indicates whether the video should play backward.
     */
    reversed(): boolean;
}
export declare class Vector<T> {
    private constructor();
    /**
     * Get item from Vector by index.
     */
    get(index: number): T;
    /**
     * Push item into Vector.
     */
    push_back(value: T): void;
    /**
     * Get item number in Vector.
     */
    size(): number;
    /**
     * Delete Vector instance.
     */
    delete(): void;
}
export declare class SoftwareDecoder {
    onConfigure(headers: Uint8Array[], mimeType: string, width: number, height: number): boolean;
    onSendBytes(bytes: Uint8Array, timestamp: number): DecoderResult;
    onDecodeFrame(): DecoderResult;
    onEndOfStream(): DecoderResult;
    onFlush(): void;
    onRenderFrame(): YUVBuffer | null;
    onRelease(): void;
}
export declare class SoftwareDecoderFactory {
    createSoftwareDecoder(pag: PAG): SoftwareDecoder | null;
}
