libpag 4.4.35 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -98,6 +98,13 @@ export class PAGView extends NativePAGView {
98
98
  };
99
99
  }
100
100
 
101
+ /**
102
+ * WeChat Mini Programs do not support capturing screenshots of WebGL Canvas.
103
+ */
104
+ public override makeSnapshot(): never {
105
+ throw new Error('WeChat Mini Programs do not support capturing screenshots of WebGL Canvas');
106
+ }
107
+
101
108
  protected override async flushLoop(force = false) {
102
109
  if (!this.isPlaying) return;
103
110
  this.setTimer();
@@ -2,10 +2,12 @@ import type { Rect } from '../types';
2
2
  export declare class ScalerContext {
3
3
  static canvas: HTMLCanvasElement | OffscreenCanvas;
4
4
  static context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
5
+ private static hasMeasureBoundsAPI;
5
6
  static setCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
6
7
  static setContext(context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
7
8
  static isUnicodePropertyEscapeSupported(): boolean;
8
9
  static isEmoji(text: string): boolean;
10
+ private static measureDirectly;
9
11
  private readonly fontName;
10
12
  private readonly fontStyle;
11
13
  private readonly size;
@@ -3,11 +3,7 @@ import { BitmapImage } from './core/bitmap-image';
3
3
  import type { EmscriptenGL, TGFX } from './types';
4
4
  export declare const createImage: (source: string) => Promise<HTMLImageElement>;
5
5
  export declare const createImageFromBytes: (bytes: ArrayBuffer) => Promise<HTMLImageElement>;
6
- export declare const readImagePixels: (module: TGFX, image: CanvasImageSource, width: number, height: number) => {
7
- byteOffset: number;
8
- length: number;
9
- free: () => void;
10
- };
6
+ export declare const readImagePixels: (module: TGFX, image: CanvasImageSource, width: number, height: number) => Uint8Array;
11
7
  export declare const hasWebpSupport: () => boolean;
12
8
  export declare const getSourceSize: (source: TexImageSource | OffscreenCanvas) => {
13
9
  width: number;
@@ -16,9 +12,5 @@ export declare const getSourceSize: (source: TexImageSource | OffscreenCanvas) =
16
12
  export declare const uploadToTexture: (GL: EmscriptenGL, source: TexImageSource | OffscreenCanvas | BitmapImage, textureID: number, alphaOnly: boolean) => void;
17
13
  export declare const isAndroidMiniprogram: () => boolean;
18
14
  export declare const releaseNativeImage: (source: TexImageSource | OffscreenCanvas) => void;
19
- export declare const getBytesFromPath: (module: TGFX, path: string) => Promise<{
20
- byteOffset: number;
21
- length: number;
22
- free: () => void;
23
- }>;
15
+ export declare const getBytesFromPath: (module: TGFX, path: string) => Promise<Uint8Array>;
24
16
  export { getCanvas2D as createCanvas2D };
@@ -29,8 +29,10 @@ export declare class PAGLayer {
29
29
  */
30
30
  resetMatrix(): void;
31
31
  /**
32
- * The final matrix for displaying, it is the combination of the matrix property and current
33
- * matrix from animation.
32
+ * Returns the layer's display matrix by combining its matrix) property with the current animation
33
+ * matrix from the AE timeline. This does not include the parent layer's matrix.
34
+ * To calculate the final bounds relative to the PAGSurface, use the PAGPlayer::getBounds(PAGLayer layer)
35
+ * method directly.
34
36
  */
35
37
  getTotalMatrix(): Matrix;
36
38
  /**
@@ -26,12 +26,12 @@ declare global {
26
26
  }
27
27
  export interface PAG extends EmscriptenModule {
28
28
  _PAGFile: {
29
- _Load: (bytes: number, length: number) => any;
29
+ _Load: (buffer: Uint8Array) => any;
30
30
  _MaxSupportedTagLevel: () => number;
31
31
  };
32
32
  _PAGImage: {
33
33
  _FromNativeImage: (source: TexImageSource | ArrayBufferImage) => any;
34
- _FromPixels: (pixels: number, width: number, height: number, rowBytes: number, colorType: ColorType, alphaType: AlphaType) => any;
34
+ _FromPixels: (pixels: Uint8Array, width: number, height: number, rowBytes: number, colorType: ColorType, alphaType: AlphaType) => any;
35
35
  _FromTexture: (textureID: number, width: number, height: number, flipY: boolean) => any;
36
36
  };
37
37
  _PAGPlayer: any;