///
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 { VideoReaderManager } from "./interfaces";
import type { ScalerContextConstructor, VideoDecoderConstructor } from './interfaces';
import type { ArrayBufferImage } from '../../third_party/tgfx/web/src/wechat/array-buffer-image';
import type { TGFXPathFillType, TGFXLineCap, TGFXLineJoin, EmscriptenGL, ctor, Point, Vector, Rect } from '../../third_party/tgfx/web/src/types';
export type { EmscriptenGL, ctor, Point, Vector, Rect };
declare global {
interface Window {
WeixinJSBridge?: any;
}
}
export interface PAG extends EmscriptenModule {
_PAGFile: {
_Load: (buffer: Uint8Array) => any;
_MaxSupportedTagLevel: () => number;
};
_PAGImage: {
_FromNativeImage: (source: TexImageSource | ArrayBufferImage) => any;
_FromPixels: (pixels: Uint8Array, 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;
module: 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;
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;
currentPlayer: PAGPlayer | null;
videoReaderManager: VideoReaderManager | null;
_videoInfoManager: {
_Make: (pagFile: any) => any;
_HasVideo: (pagFile: any) => any;
};
_useSoftwareDecoder: boolean;
[key: string]: any;
}
/**
* 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",
/**
* [Deprecated]
* Notifies the flushed of the animation.
*/
onAnimationFlushed = "onAnimationFlushed"
}
export interface PAGViewEventMap {
/**
* Notifies the start of the animation.
*/
onAnimationStart: PAGView;
/**
* Notifies the end of the animation.
*/
onAnimationEnd: PAGView;
/**
* Notifies the cancellation of the animation.
*/
onAnimationCancel: PAGView;
/**
* Notifies the repetition of the animation.
*/
onAnimationRepeat: PAGView;
/**
* Notifies the update of the animation.
*/
onAnimationUpdate: PAGView;
/**
* [Deprecated]
* Notifies the play of the animation.
*/
onAnimationPlay: PAGView;
/**
* Notifies the pause of the animation.
*/
onAnimationPause: PAGView;
/**
* [Deprecated]
* Notifies the flushed of the animation.
*/
onAnimationFlushed: PAGView;
}
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
}
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
}
/**
* 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 YUVBuffer {
data: number[];
lineSize: number[];
}
export interface DebugData {
FPS?: number;
flushTime?: number;
}
export interface PAGVideoRange {
/**
* 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 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 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;
/**
* For box text, the pixel dimensions for the text bounds.
*/
boxTextSize: Readonly;
firstBaseLine: number;
fauxBold: boolean;
fauxItalic: boolean;
/**
* The text layer’s fill color.
*/
fillColor: Readonly;
/**
* 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;
/**
* 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;
/**
* The text layer’s background alpha. 0 = 100% transparent, 255 = 100% opaque.
*/
backgroundAlpha: number;
direction: TextDirection;
delete: () => void;
private constructor();
}
export declare class SoftwareDecoder {
onConfigure(headers: Uint8Array[], mimeType: string, width: number, height: number): boolean;
onSendBytes(bytes: Uint8Array, timestamp: number): number;
onDecodeFrame(): number;
onEndOfStream(): number;
onFlush(): void;
onRenderFrame(): YUVBuffer | null;
onRelease(): void;
}
export declare class SoftwareDecoderFactory {
createSoftwareDecoder(pag: PAG): SoftwareDecoder | null;
}
export declare class VecArray extends Array {
private isDeleted;
private constructor();
static create(): VecArray;
get(index: number): any;
push_back(value: any): void;
size(): number;
delete(): void;
private ensureNotDeleted;
}