@leafer/interface 2.0.1 → 2.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/interface",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -13,6 +13,8 @@ import { IFourNumber, IObject } from '../data/IData'
13
13
  import { IZoomView } from '../display/IView'
14
14
  import { IAppBase } from './IApp'
15
15
  import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
16
+ import { ILeaferFilm, ILeaferFilmConfig } from '../image/ILeaferFilm'
17
+ import { ILeaferVideo, ILeaferVideoConfig } from '../image/ILeaferVideo'
16
18
  import { IControl } from '../control/IControl'
17
19
  import { IFunction } from '../function/IFunction'
18
20
  import { ITransition } from '../animate/ITransition'
@@ -79,8 +81,8 @@ export interface ILeaferAttrData {
79
81
  start(): void
80
82
  stop(): void
81
83
 
82
- unlockLayout(): void
83
- lockLayout(): void
84
+ unlockLayout(updateLayout?: boolean): void
85
+ lockLayout(updateLayout?: boolean): void
84
86
 
85
87
  requestRender(change: boolean): void
86
88
 
@@ -135,6 +137,8 @@ export interface ILeaferTypeList {
135
137
 
136
138
  export interface ICreator {
137
139
  image?(options?: ILeaferImageConfig): ILeaferImage
140
+ film?(options?: ILeaferFilmConfig): ILeaferFilm
141
+ video?(options?: ILeaferVideoConfig): ILeaferVideo
138
142
  canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas
139
143
  hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas
140
144
  hitCanvasManager?(): IHitCanvasManager
package/src/data/IList.ts CHANGED
@@ -15,6 +15,9 @@ export interface ILeafList {
15
15
  list: ILeaf[]
16
16
  keys: INumberMap
17
17
  readonly length: number
18
+
19
+ needUpdate?: boolean // 一般用于event更新path
20
+
18
21
  has(leaf: ILeaf): boolean
19
22
  indexAt(index: number): ILeaf
20
23
  indexOf(leaf: ILeaf): number
@@ -245,6 +245,7 @@ export interface ILeafAttrData {
245
245
  mask?: IBoolean | IMaskType
246
246
  eraser?: IBoolean | IEraserType
247
247
  filter?: IFilter | IFilter[]
248
+ complex?: boolean
248
249
 
249
250
  // layout data
250
251
  x?: INumber
@@ -353,6 +354,7 @@ export interface ILeafComputedData {
353
354
  mask?: boolean | IMaskType
354
355
  eraser?: boolean | IEraserType
355
356
  filter?: IFilter[]
357
+ complex?: boolean
356
358
 
357
359
  // layout data
358
360
  x?: number
@@ -487,6 +489,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
487
489
  proxyData?: ILeafInputData
488
490
  __proxyData?: ILeafInputData
489
491
 
492
+ skipJSON?: boolean // 跳过 JSON 导出
490
493
  syncEventer?: ILeaf // 同步触发一样事件的元素
491
494
  lockNormalStyle?: boolean
492
495
 
@@ -696,6 +699,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
696
699
 
697
700
  // ILeafRender ->
698
701
  __render(canvas: ILeaferCanvas, options: IRenderOptions): void
702
+ __renderComplex(canvas: ILeaferCanvas, options: IRenderOptions): void
699
703
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
700
704
  __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void
701
705
 
@@ -1,2 +1,32 @@
1
- export type IExportImageType = 'jpg' | 'png' | 'webp' | 'bmp'
2
- export type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json'
1
+ export type IExportImageType =
2
+ | 'jpg'
3
+ | 'png'
4
+ | 'webp'
5
+ | 'bmp'
6
+
7
+ export type IExportFileType =
8
+ | 'svg'
9
+ | 'pdf'
10
+ | 'json'
11
+ | IExportImageType
12
+
13
+ export type IFilmFileType =
14
+ | 'gif'
15
+ | 'webp'
16
+ | 'png' // apng
17
+ | 'avif'
18
+
19
+ export type IVideoFileType =
20
+ | 'mp4'
21
+ | 'webm'
22
+ | 'ogv' // ogg
23
+
24
+ export type IMultimediaType =
25
+ | 'image'
26
+ | 'film'
27
+ | 'video'
28
+
29
+ export type IResponseType =
30
+ | 'text'
31
+ | 'json'
32
+ | 'arrayBuffer'
@@ -1,13 +1,18 @@
1
1
  import { ITaskProcessor } from '../task/ITaskProcessor'
2
2
  import { ILeaferImage } from '../image/ILeaferImage'
3
- import { IExportFileType } from './IFileType'
3
+ import { IExportFileType, IFilmFileType, IVideoFileType } from './IFileType'
4
4
  import { IObject } from '../data/IData'
5
5
  import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
6
+ import { ILeaferFilm } from '../image/ILeaferFilm'
7
+ import { ILeaferVideo } from '../image/ILeaferVideo'
6
8
 
7
9
 
8
10
  export interface IResource {
9
11
  map: any,
12
+
10
13
  tasker: ITaskProcessor
14
+ queue: ITaskProcessor
15
+
11
16
  readonly isComplete: boolean
12
17
 
13
18
  set(key: string, value: any): void
@@ -17,5 +22,8 @@ export interface IResource {
17
22
  setImage(key: string, value: string | IObject | ILeaferImage | ILeaferCanvas, format?: IExportFileType): ILeaferImage
18
23
  loadImage(key: string, format?: IExportFileType): Promise<ILeaferImage>
19
24
 
25
+ loadFilm(key: string, format?: IFilmFileType): Promise<ILeaferFilm>
26
+ loadVideo(key: string, format?: IVideoFileType): Promise<ILeaferVideo>
27
+
20
28
  destroy(): void
21
29
  }
@@ -1,6 +1,6 @@
1
1
  import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
2
2
  import { ITaskProcessor } from '../task/ITaskProcessor'
3
- import { IExportFileType } from '../file/IFileType'
3
+ import { IExportFileType, IMultimediaType } from '../file/IFileType'
4
4
 
5
5
 
6
6
  export interface IImageManager {
@@ -10,7 +10,7 @@ export interface IImageManager {
10
10
  patternTasker: ITaskProcessor
11
11
  patternLocked?: boolean // 锁定pattern不更新, 一般用于创建碰撞位图 UIHit.ts
12
12
 
13
- get(config: ILeaferImageConfig): ILeaferImage
13
+ get(config: ILeaferImageConfig, type?: IMultimediaType): ILeaferImage
14
14
  recycle(image: ILeaferImage): void
15
15
 
16
16
  recyclePaint(paint: any): void
@@ -0,0 +1,63 @@
1
+ import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
2
+ import { ILeaf } from '../display/ILeaf'
3
+ import { IPointData, IOptionPointData } from '../math/IMath'
4
+ import { ICanvasContext2D } from '../canvas/ICanvas'
5
+
6
+ export interface ILeaferFilmConfig extends ILeaferImageConfig {
7
+
8
+ }
9
+
10
+ export interface ILeaferFilm extends ILeaferImage {
11
+
12
+ }
13
+
14
+ export interface IFilmDecoder {
15
+ width: number
16
+ height: number
17
+
18
+ total: number
19
+ loop: number
20
+ frames: IFilmFrame[]
21
+
22
+ atlas?: any // 合并图
23
+ atlasContext?: any // 合并图的上下文手柄
24
+ atlasGrid?: IPointData
25
+
26
+ decoder: any
27
+
28
+ bufferCanvas?: any // 缓冲图
29
+ bufferContext?: ICanvasContext2D
30
+
31
+ createAtlas(): void
32
+ decodeHeader(data: ArrayBuffer, type: string): Promise<void>
33
+ decodeFrame(frameIndex: number): Promise<IFilmFrame>
34
+ decodeOneFrame(frameIndex: number): Promise<IFilmFrame>
35
+ mergeFrame(frameIndex: number, destoryFrameImage: boolean): void
36
+
37
+ render(canvas: any, x: number, y: number, width: number, height: number, leaf: ILeaf, paint: any, imageScaleX: number, imageScaleY: number): void
38
+
39
+ destoryFrame(frameIndex: number, deleteIndex: boolean): void
40
+ destoryFrameImage(frame: IFilmFrame): void
41
+ destroyDecoder(): void
42
+ close(): void
43
+ }
44
+
45
+ export interface IFilmFrame extends IOptionPointData {
46
+ image?: any // 不存在时使用合并图
47
+ duration: number // 毫秒
48
+ decoding?: boolean // 正在解码中
49
+ }
50
+
51
+ export interface IFilmOptions {
52
+ nowIndex?: number
53
+ pauseIndex?: number // 播放到这一帧暂停
54
+ loop?: number
55
+ speed?: number
56
+ autoplay?: boolean
57
+ }
58
+
59
+ export interface IFilmPlayOptions extends IFilmOptions {
60
+ frameTime?: number
61
+ frameTimer?: any // 下一帧的timer
62
+ paused?: boolean
63
+ }
@@ -7,7 +7,7 @@ import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
7
7
  import { IProgressData } from '../event/IProgress'
8
8
  import { IImageCrossOrigin } from '../platform/IPlatform'
9
9
  import { ITaskItem } from '../task/ITaskProcessor'
10
- import { IRangeSize, IInterlace } from '../display/ILeaf'
10
+ import { IRangeSize, IInterlace, ILeaf } from '../display/ILeaf'
11
11
  import { IFunction } from '../function/IFunction'
12
12
 
13
13
  export interface ILeaferImageConfig {
@@ -120,6 +120,8 @@ export interface ILeaferImage {
120
120
  getCanvas(width: number, height: number, opacity?: number, filters?: IObject, xGap?: number, yGap?: number, smooth?: boolean, interlace?: IInterlace): any
121
121
  getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern
122
122
 
123
+ render(canvas: any, x: number, y: number, width: number, height: number, leaf: ILeaf, paint: any, imageScaleX: number, imageScaleY: number): void
124
+
123
125
  getLoadUrl(thumbSize?: ISizeData): string
124
126
  setThumbView(view: number): void
125
127
  getThumbSize(lod?: IImageLOD): ISizeData
@@ -0,0 +1,9 @@
1
+ import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
2
+
3
+ export interface ILeaferVideoConfig extends ILeaferImageConfig {
4
+
5
+ }
6
+
7
+ export interface ILeaferVideo extends ILeaferImage {
8
+
9
+ }
package/src/index.ts CHANGED
@@ -41,8 +41,10 @@ export { IWindingRule, ICanvasContext2D, ICanvasContext2DSettings, ITextMetrics,
41
41
  export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData, MoveToCommandObject, LineToCommandObject, BezierCurveToCommandObject, QuadraticCurveToCommandObject, IPathCommandObject, IPathCommandNodeBase, MoveToCommandNode, LineToCommandNode, BezierCurveToCommandNode, ClosePathCommandNode, IPathCommandNode, PathNodeHandleType, PathNodeHandleName, IPathNodeBase } from './path/IPathCommand'
42
42
 
43
43
  export { ILeaferImage, ILeaferImageConfig, IImageLOD, IImageTileLOD, ILeaferImageSliceData, ILeaferImageSlice, ILeaferImageLevel, ILeaferImageOnLoaded, ILeaferImageOnError, ILeaferImageCacheCanvas, ILeaferImagePatternPaint } from './image/ILeaferImage'
44
+ export { ILeaferFilm, ILeaferFilmConfig, IFilmDecoder, IFilmFrame, IFilmOptions, IFilmPlayOptions } from './image/ILeaferFilm'
45
+ export { ILeaferVideo, ILeaferVideoConfig } from './image/ILeaferVideo'
44
46
  export { IResource } from './file/IResource'
45
- export { IExportFileType, IExportImageType } from './file/IFileType'
47
+ export { IExportFileType, IExportImageType, IFilmFileType, IVideoFileType, IMultimediaType, IResponseType } from './file/IFileType'
46
48
  export { IExportOptions, IJSONOptions, IExportResult, IExportResultFunction, IExportOnCanvasFunction } from './file/IExport'
47
49
 
48
50
  export { InnerId, IEventer, IEventParamsMap, IEventParams, IEventListener, IEventOption, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
@@ -56,7 +58,7 @@ export { ITransformer } from './interaction/ITransformer'
56
58
 
57
59
  export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IFunctionMap, IPointDataMap, IDataTypeHandle } from './data/IData'
58
60
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
59
- export { IPoint, IPointData, IFromToData, IUnitPointData, IRotationPointData, IScrollPointData, IClientPointData, IRadiusPointData, ISize, ISizeData, IOptionSizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, IBoundsDataWithOptionRotation, ITwoPointBoundsData, IAutoBounds, IAutoBoxData, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithOptionScaleData, IMatrixWithOptionHalfData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
61
+ export { IPoint, IPointData, IOptionPointData, IFromToData, IUnitPointData, IRotationPointData, IScrollPointData, IClientPointData, IRadiusPointData, ISize, ISizeData, IOptionSizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, IBoundsDataWithOptionRotation, ITwoPointBoundsData, IAutoBounds, IAutoBoxData, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithOptionScaleData, IMatrixWithOptionHalfData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
60
62
  export { IFunction, IStringFunction, INumberFunction, IObjectFunction, IValueFunction, IPointDataFunction, IAttrDecorator } from './function/IFunction'
61
63
 
62
64
  export { ITransition, IAnimateEasing, ICubicBezierEasing, IStepsEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvents, IAnimateEventFunction, ICustomEasingFunction, IAnimateOptions } from './animate/ITransition'
package/src/math/IMath.ts CHANGED
@@ -6,6 +6,11 @@ export interface IPointData {
6
6
  y: number
7
7
  }
8
8
 
9
+ export interface IOptionPointData {
10
+ x?: number
11
+ y?: number
12
+ }
13
+
9
14
  export interface IUnitPointData extends IPointData {
10
15
  type?: 'percent' | 'px'
11
16
  }
@@ -1,13 +1,15 @@
1
1
  import { IFunction, IStringFunction } from '../function/IFunction'
2
2
  import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
3
3
  import { IInterlace, ILeaf } from '../display/ILeaf'
4
- import { IExportFileType, IExportImageType } from '../file/IFileType'
4
+ import { IExportFileType, IExportImageType, IResponseType } from '../file/IFileType'
5
5
  import { IBoundsData, ISizeData, IMatrixData } from '../math/IMath'
6
6
  import { IObject } from '../data/IData'
7
7
  import { ICanvasType } from '../canvas/ISkiaCanvas'
8
8
  import { ISelector } from '../selector/ISelector'
9
9
  import { IRenderOptions } from '../renderer/IRenderer'
10
10
  import { ILeaferImage } from '../image/ILeaferImage'
11
+ import { ILeaferFilm } from '../image/ILeaferFilm'
12
+ import { ILeaferVideo } from '../image/ILeaferVideo'
11
13
  import { ICanvasPattern } from '../canvas/ICanvas'
12
14
 
13
15
 
@@ -45,6 +47,9 @@ export interface IPlatform {
45
47
  canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
46
48
  download(url: string, filename: string): Promise<void>
47
49
  loadImage(url: string, crossOrigin?: IImageCrossOrigin, leaferImage?: ILeaferImage): Promise<any>
50
+ loadFilm?(url: string, crossOrigin?: IImageCrossOrigin, leaferFilm?: ILeaferFilm): Promise<any>
51
+ loadVideo?(url: string, crossOrigin?: IImageCrossOrigin, leaferVideo?: ILeaferVideo): Promise<any>
52
+ loadContent(url: string, responseType: IResponseType): Promise<any>
48
53
  noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
49
54
  Image?: any
50
55
  PointerEvent?: any
@@ -66,6 +66,6 @@ export interface IRenderer extends IControl {
66
66
  clipRender(bounds: IBounds): void
67
67
  fullRender(): void
68
68
 
69
- addBlock(block: IBounds): void
69
+ addBlock(block: IBounds, leafList?: ILeafList): void
70
70
  mergeBlocks(): void
71
71
  }
package/types/index.d.ts CHANGED
@@ -4,6 +4,10 @@ interface IPointData {
4
4
  x: number;
5
5
  y: number;
6
6
  }
7
+ interface IOptionPointData {
8
+ x?: number;
9
+ y?: number;
10
+ }
7
11
  interface IUnitPointData extends IPointData {
8
12
  type?: 'percent' | 'px';
9
13
  }
@@ -264,6 +268,7 @@ interface ILeafList {
264
268
  list: ILeaf[];
265
269
  keys: INumberMap;
266
270
  readonly length: number;
271
+ needUpdate?: boolean;
267
272
  has(leaf: ILeaf): boolean;
268
273
  indexAt(index: number): ILeaf;
269
274
  indexOf(leaf: ILeaf): number;
@@ -911,7 +916,11 @@ interface ICanvasManager {
911
916
  }
912
917
 
913
918
  type IExportImageType = 'jpg' | 'png' | 'webp' | 'bmp';
914
- type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json';
919
+ type IExportFileType = 'svg' | 'pdf' | 'json' | IExportImageType;
920
+ type IFilmFileType = 'gif' | 'webp' | 'png' | 'avif';
921
+ type IVideoFileType = 'mp4' | 'webm' | 'ogv';
922
+ type IMultimediaType = 'image' | 'film' | 'video';
923
+ type IResponseType = 'text' | 'json' | 'arrayBuffer';
915
924
 
916
925
  type ILocationType = 'world' | 'page' | 'local' | 'inner';
917
926
  type IBoundsType = 'content' | 'box' | 'stroke' | 'render';
@@ -1228,7 +1237,7 @@ interface IRenderer extends IControl {
1228
1237
  partRender(): void;
1229
1238
  clipRender(bounds: IBounds): void;
1230
1239
  fullRender(): void;
1231
- addBlock(block: IBounds): void;
1240
+ addBlock(block: IBounds, leafList?: ILeafList): void;
1232
1241
  mergeBlocks(): void;
1233
1242
  }
1234
1243
 
@@ -1521,6 +1530,7 @@ interface ILeafAttrData {
1521
1530
  mask?: IBoolean | IMaskType;
1522
1531
  eraser?: IBoolean | IEraserType;
1523
1532
  filter?: IFilter | IFilter[];
1533
+ complex?: boolean;
1524
1534
  x?: INumber;
1525
1535
  y?: INumber;
1526
1536
  width?: INumber;
@@ -1599,6 +1609,7 @@ interface ILeafComputedData {
1599
1609
  mask?: boolean | IMaskType;
1600
1610
  eraser?: boolean | IEraserType;
1601
1611
  filter?: IFilter[];
1612
+ complex?: boolean;
1602
1613
  x?: number;
1603
1614
  y?: number;
1604
1615
  width?: number;
@@ -1696,6 +1707,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1696
1707
  __: ILeafData;
1697
1708
  proxyData?: ILeafInputData;
1698
1709
  __proxyData?: ILeafInputData;
1710
+ skipJSON?: boolean;
1699
1711
  syncEventer?: ILeaf;
1700
1712
  lockNormalStyle?: boolean;
1701
1713
  __layout: ILeafLayout;
@@ -1843,6 +1855,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1843
1855
  __drawHitPath(canvas: ILeaferCanvas): void;
1844
1856
  __updateHitCanvas(): void;
1845
1857
  __render(canvas: ILeaferCanvas, options: IRenderOptions): void;
1858
+ __renderComplex(canvas: ILeaferCanvas, options: IRenderOptions): void;
1846
1859
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void;
1847
1860
  __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
1848
1861
  __clip(canvas: ILeaferCanvas, options: IRenderOptions): void;
@@ -1910,6 +1923,56 @@ interface ISkiaNAPICanvas {
1910
1923
  toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>;
1911
1924
  }
1912
1925
 
1926
+ interface ILeaferFilmConfig extends ILeaferImageConfig {
1927
+ }
1928
+ interface ILeaferFilm extends ILeaferImage {
1929
+ }
1930
+ interface IFilmDecoder {
1931
+ width: number;
1932
+ height: number;
1933
+ total: number;
1934
+ loop: number;
1935
+ frames: IFilmFrame[];
1936
+ atlas?: any;
1937
+ atlasContext?: any;
1938
+ atlasGrid?: IPointData;
1939
+ decoder: any;
1940
+ bufferCanvas?: any;
1941
+ bufferContext?: ICanvasContext2D;
1942
+ createAtlas(): void;
1943
+ decodeHeader(data: ArrayBuffer, type: string): Promise<void>;
1944
+ decodeFrame(frameIndex: number): Promise<IFilmFrame>;
1945
+ decodeOneFrame(frameIndex: number): Promise<IFilmFrame>;
1946
+ mergeFrame(frameIndex: number, destoryFrameImage: boolean): void;
1947
+ render(canvas: any, x: number, y: number, width: number, height: number, leaf: ILeaf, paint: any, imageScaleX: number, imageScaleY: number): void;
1948
+ destoryFrame(frameIndex: number, deleteIndex: boolean): void;
1949
+ destoryFrameImage(frame: IFilmFrame): void;
1950
+ destroyDecoder(): void;
1951
+ close(): void;
1952
+ }
1953
+ interface IFilmFrame extends IOptionPointData {
1954
+ image?: any;
1955
+ duration: number;
1956
+ decoding?: boolean;
1957
+ }
1958
+ interface IFilmOptions {
1959
+ nowIndex?: number;
1960
+ pauseIndex?: number;
1961
+ loop?: number;
1962
+ speed?: number;
1963
+ autoplay?: boolean;
1964
+ }
1965
+ interface IFilmPlayOptions extends IFilmOptions {
1966
+ frameTime?: number;
1967
+ frameTimer?: any;
1968
+ paused?: boolean;
1969
+ }
1970
+
1971
+ interface ILeaferVideoConfig extends ILeaferImageConfig {
1972
+ }
1973
+ interface ILeaferVideo extends ILeaferImage {
1974
+ }
1975
+
1913
1976
  interface IPlatform {
1914
1977
  name?: 'web' | 'node' | 'miniapp';
1915
1978
  os?: 'Mac' | 'Windows' | 'Linux';
@@ -1938,6 +2001,9 @@ interface IPlatform {
1938
2001
  canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>;
1939
2002
  download(url: string, filename: string): Promise<void>;
1940
2003
  loadImage(url: string, crossOrigin?: IImageCrossOrigin, leaferImage?: ILeaferImage): Promise<any>;
2004
+ loadFilm?(url: string, crossOrigin?: IImageCrossOrigin, leaferFilm?: ILeaferFilm): Promise<any>;
2005
+ loadVideo?(url: string, crossOrigin?: IImageCrossOrigin, leaferVideo?: ILeaferVideo): Promise<any>;
2006
+ loadContent(url: string, responseType: IResponseType): Promise<any>;
1941
2007
  noRepeat?: string;
1942
2008
  Image?: any;
1943
2009
  PointerEvent?: any;
@@ -2115,6 +2181,7 @@ interface ILeaferImage {
2115
2181
  getFull(filters?: IObject): any;
2116
2182
  getCanvas(width: number, height: number, opacity?: number, filters?: IObject, xGap?: number, yGap?: number, smooth?: boolean, interlace?: IInterlace): any;
2117
2183
  getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern;
2184
+ render(canvas: any, x: number, y: number, width: number, height: number, leaf: ILeaf, paint: any, imageScaleX: number, imageScaleY: number): void;
2118
2185
  getLoadUrl(thumbSize?: ISizeData): string;
2119
2186
  setThumbView(view: number): void;
2120
2187
  getThumbSize(lod?: IImageLOD): ISizeData;
@@ -2407,8 +2474,8 @@ interface ILeaferAttrData {
2407
2474
  init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void;
2408
2475
  start(): void;
2409
2476
  stop(): void;
2410
- unlockLayout(): void;
2411
- lockLayout(): void;
2477
+ unlockLayout(updateLayout?: boolean): void;
2478
+ lockLayout(updateLayout?: boolean): void;
2412
2479
  requestRender(change: boolean): void;
2413
2480
  updateCursor(cursor?: ICursorType): void;
2414
2481
  resize(size: IScreenSizeData): void;
@@ -2450,6 +2517,8 @@ interface ILeaferTypeList {
2450
2517
  }
2451
2518
  interface ICreator {
2452
2519
  image?(options?: ILeaferImageConfig): ILeaferImage;
2520
+ film?(options?: ILeaferFilmConfig): ILeaferFilm;
2521
+ video?(options?: ILeaferVideoConfig): ILeaferVideo;
2453
2522
  canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas;
2454
2523
  hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas;
2455
2524
  hitCanvasManager?(): IHitCanvasManager;
@@ -2481,7 +2550,7 @@ interface IImageManager {
2481
2550
  recycledList: ILeaferImage[];
2482
2551
  patternTasker: ITaskProcessor;
2483
2552
  patternLocked?: boolean;
2484
- get(config: ILeaferImageConfig): ILeaferImage;
2553
+ get(config: ILeaferImageConfig, type?: IMultimediaType): ILeaferImage;
2485
2554
  recycle(image: ILeaferImage): void;
2486
2555
  recyclePaint(paint: any): void;
2487
2556
  clearRecycled(force?: boolean): void;
@@ -2502,12 +2571,15 @@ interface IPlugin extends IObject {
2502
2571
  interface IResource {
2503
2572
  map: any;
2504
2573
  tasker: ITaskProcessor;
2574
+ queue: ITaskProcessor;
2505
2575
  readonly isComplete: boolean;
2506
2576
  set(key: string, value: any): void;
2507
2577
  get(key: string): any;
2508
2578
  remove(key: string): void;
2509
2579
  setImage(key: string, value: string | IObject | ILeaferImage | ILeaferCanvas, format?: IExportFileType): ILeaferImage;
2510
2580
  loadImage(key: string, format?: IExportFileType): Promise<ILeaferImage>;
2581
+ loadFilm(key: string, format?: IFilmFileType): Promise<ILeaferFilm>;
2582
+ loadVideo(key: string, format?: IVideoFileType): Promise<ILeaferVideo>;
2511
2583
  destroy(): void;
2512
2584
  }
2513
2585
 
@@ -2535,4 +2607,4 @@ interface ITransformer {
2535
2607
  }
2536
2608
 
2537
2609
  export { PathNodeHandleType };
2538
- export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandNode, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, ClosePathCommandNode, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsDataWithOptionRotation, IBoundsEvent, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasSizeAttr, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragBoundsType, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventOption, IEventParams, IEventParamsMap, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IGestureType, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCrossOrigin, IImageCursor, IImageEvent, IImageLOD, IImageManager, IImageTileLOD, IInteraction, IInteractionCanvas, IInteractionConfig, IInterlace, IJSONOptions, IKeepTouchData, IKeyCodes, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageLevel, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferImageSlice, ILeaferImageSliceData, ILeaferMode, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandNode, IPathCommandNodeBase, IPathCommandObject, IPathCreator, IPathDrawer, IPathNodeBase, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IRotateEvent, IRotationPointData, IScaleData, IScaleFixed, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, IShortcutKeyCodes, IShortcutKeys, IShortcutKeysCheck, ISide, ISingleGestureConfig, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITouchEvent, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IWindingRuleData, IZoomConfig, IZoomEvent, IZoomOptions, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandNode, LineToCommandObject, MCommandData, MoveToCommandNode, MoveToCommandObject, PathNodeHandleName, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
2610
+ export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandNode, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, ClosePathCommandNode, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsDataWithOptionRotation, IBoundsEvent, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasSizeAttr, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragBoundsType, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventOption, IEventParams, IEventParamsMap, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilmDecoder, IFilmFileType, IFilmFrame, IFilmOptions, IFilmPlayOptions, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IGestureType, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCrossOrigin, IImageCursor, IImageEvent, IImageLOD, IImageManager, IImageTileLOD, IInteraction, IInteractionCanvas, IInteractionConfig, IInterlace, IJSONOptions, IKeepTouchData, IKeyCodes, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferFilm, ILeaferFilmConfig, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageLevel, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferImageSlice, ILeaferImageSliceData, ILeaferMode, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferVideo, ILeaferVideoConfig, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, IMultimediaType, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionPointData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandNode, IPathCommandNodeBase, IPathCommandObject, IPathCreator, IPathDrawer, IPathNodeBase, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IResponseType, IRotateEvent, IRotationPointData, IScaleData, IScaleFixed, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, IShortcutKeyCodes, IShortcutKeys, IShortcutKeysCheck, ISide, ISingleGestureConfig, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITouchEvent, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IVideoFileType, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IWindingRuleData, IZoomConfig, IZoomEvent, IZoomOptions, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandNode, LineToCommandObject, MCommandData, MoveToCommandNode, MoveToCommandObject, PathNodeHandleName, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };