@yft-design/engine 0.0.34 → 0.0.36
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.
- package/dist/EngineCanvas.d.ts +2 -0
- package/dist/decoders/animatedImage.d.ts +4 -0
- package/dist/decoders/apng2sprite.d.ts +6 -0
- package/dist/decoders/gif2sprite.d.ts +4 -2
- package/dist/decoders/spriteCanvas.d.ts +13 -0
- package/dist/decoders/webp2sprite.d.ts +2 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +47 -47
- package/dist/render/SourceManager.d.ts +3 -0
- package/package.json +5 -3
package/dist/EngineCanvas.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { MeshBatch } from './render/MeshBatch';
|
|
|
24
24
|
import { QuadBatch } from './render/QuadBatch';
|
|
25
25
|
import { SceneRenderer, type SceneRendererHost } from './render/SceneRenderer';
|
|
26
26
|
import { type SourceHost } from './render/SourceManager';
|
|
27
|
+
import type { AnimatedSourceDecoder } from './decoders/animatedImage';
|
|
27
28
|
import { type SceneExportHost } from './export/SceneExporter';
|
|
28
29
|
import type { ExportPixels, ExportRawPixels, ExportRegion } from './export/glExport';
|
|
29
30
|
import { type HandleId } from './render/selectionOverlay';
|
|
@@ -49,6 +50,7 @@ export declare class EngineCanvas implements PointerHost, TextEditingHost, Sourc
|
|
|
49
50
|
private readonly glyphAtlas;
|
|
50
51
|
readonly renderEpoch: RenderEpoch;
|
|
51
52
|
bakeKReuseFloor: number;
|
|
53
|
+
decodeAnimated: AnimatedSourceDecoder | null;
|
|
52
54
|
private readonly sources;
|
|
53
55
|
private readonly textRenderer;
|
|
54
56
|
readonly renderer: SceneRenderer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GifSprite } from './gif2sprite';
|
|
2
|
+
import type { SpriteDecodeOptions } from './spriteCanvas';
|
|
3
|
+
export type AnimatedSourceDecoder = (buffer: ArrayBuffer) => Promise<GifSprite>;
|
|
4
|
+
export declare const decodeAnimatedImage: (buffer: ArrayBuffer, options?: SpriteDecodeOptions) => Promise<GifSprite>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GifSprite } from './gif2sprite';
|
|
2
|
+
import type { SpriteDecodeOptions } from './spriteCanvas';
|
|
3
|
+
export declare const isAnimatedPng: (buffer: ArrayBuffer) => boolean;
|
|
4
|
+
export declare const isAnimatedPngFile: (file: Blob) => Promise<boolean>;
|
|
5
|
+
export declare const isAnimatedPngUrl: (url: string) => Promise<boolean>;
|
|
6
|
+
export declare const bufferToApngSprite: (buffer: ArrayBuffer, options?: SpriteDecodeOptions) => Promise<GifSprite>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { SpriteDecodeOptions, SpriteImageSource } from './spriteCanvas';
|
|
1
2
|
export interface GifSprite {
|
|
2
|
-
canvas:
|
|
3
|
+
canvas: SpriteImageSource;
|
|
3
4
|
frameWidth: number;
|
|
4
5
|
framesLength: number;
|
|
5
6
|
delay: number;
|
|
6
7
|
frameDelays: number[];
|
|
7
8
|
duration: number;
|
|
8
9
|
}
|
|
9
|
-
export declare const bufferToGifSprite: (buffer: ArrayBuffer) => Promise<GifSprite>;
|
|
10
|
+
export declare const bufferToGifSprite: (buffer: ArrayBuffer, options?: SpriteDecodeOptions) => Promise<GifSprite>;
|
|
11
|
+
export declare const rgbaFramesToSprite: (frames: ArrayBuffer[], sourceWidth: number, sourceHeight: number, frameDelays: number[], options?: SpriteDecodeOptions) => GifSprite;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SpriteCanvas = HTMLCanvasElement | OffscreenCanvas;
|
|
2
|
+
export type SpriteImageSource = SpriteCanvas | ImageBitmap;
|
|
3
|
+
export type SpriteContext = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
4
|
+
export interface SpriteCanvasFactory {
|
|
5
|
+
create(width: number, height: number): SpriteCanvas;
|
|
6
|
+
}
|
|
7
|
+
export interface SpriteDecodeOptions {
|
|
8
|
+
canvasFactory?: SpriteCanvasFactory;
|
|
9
|
+
}
|
|
10
|
+
export declare const browserCanvasFactory: SpriteCanvasFactory;
|
|
11
|
+
export declare const spriteContext: (canvas: SpriteCanvas) => SpriteContext;
|
|
12
|
+
export declare const releaseSpriteCanvas: (canvas: SpriteCanvas) => void;
|
|
13
|
+
export declare const closeSpriteSource: (source: SpriteImageSource) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { GifSprite } from './gif2sprite';
|
|
2
|
+
import type { SpriteDecodeOptions } from './spriteCanvas';
|
|
2
3
|
export declare const isWebPBuffer: (buffer: ArrayBuffer) => boolean;
|
|
3
4
|
export declare const isAnimatedWebP: (buffer: ArrayBuffer) => boolean;
|
|
4
5
|
export declare const isAnimatedWebPFile: (file: Blob) => Promise<boolean>;
|
|
5
6
|
export declare const isAnimatedWebPUrl: (url: string) => Promise<boolean>;
|
|
6
|
-
export declare const bufferToWebpSprite: (buffer: ArrayBuffer) => Promise<GifSprite>;
|
|
7
|
+
export declare const bufferToWebpSprite: (buffer: ArrayBuffer, options?: SpriteDecodeOptions) => Promise<GifSprite>;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export { anchorStyleAt } from './model/pathEdit';
|
|
|
28
28
|
export { clearAlphaHitMask } from './model/alphaHit';
|
|
29
29
|
export { pathEditKindOf, type PathSessionInfo } from './interact/pathSession';
|
|
30
30
|
export { isAnimatedWebPFile, isAnimatedWebPUrl } from './decoders/webp2sprite';
|
|
31
|
+
export { isAnimatedPng, isAnimatedPngFile, isAnimatedPngUrl } from './decoders/apng2sprite';
|
|
32
|
+
export { decodeAnimatedImage, type AnimatedSourceDecoder } from './decoders/animatedImage';
|
|
33
|
+
export type { GifSprite } from './decoders/gif2sprite';
|
|
31
34
|
export { fboPixelsToImageData, type ExportRegion, type ExportRawPixels } from './export/glExport';
|
|
32
35
|
export { type SerializedGradientFill } from './core/gradient';
|
|
33
36
|
export { arcTextKind, computeArcTextLayout } from './model/arcLayout';
|