@leafer/interface 1.0.0-rc.5 → 1.0.0-rc.6

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": "1.0.0-rc.5",
3
+ "version": "1.0.0-rc.6",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -1,7 +1,8 @@
1
1
  import { IExportFileType, IExportImageType } from '../file/IFileType'
2
2
 
3
- export type ICanvasType = 'skia' | 'canvas' | 'wx'
3
+ export type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx'
4
4
 
5
+ // skia
5
6
  export interface ISkiaCanvas {
6
7
  toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>
7
8
  toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any
@@ -17,4 +18,22 @@ export interface ISkiaCanvasExportConfig {
17
18
  density?: number,
18
19
  quality?: number,
19
20
  outline?: boolean
21
+ }
22
+
23
+ // skia-napi
24
+ export interface ISkiaNAPICanvas {
25
+ encodeSync(format: 'webp' | 'jpeg', quality?: number): any
26
+ encodeSync(format: 'png'): any
27
+
28
+ encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>
29
+ encode(format: 'png'): Promise<any>
30
+
31
+ toBuffer(mime: 'image/png'): any
32
+ toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any
33
+
34
+ toDataURL(mime?: 'image/png'): string
35
+ toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string
36
+
37
+ toDataURLAsync(mime?: 'image/png'): Promise<string>
38
+ toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>
20
39
  }
@@ -14,7 +14,7 @@ export interface IDataProcessor extends IObject {
14
14
  __setInput(name: string, value: any): void
15
15
  __getInput(name: string): any
16
16
  __removeInput(name: string): void
17
- __getInputData(): IObject
17
+ __getInputData(options?: ILeafDataOptions): IObject
18
18
 
19
19
  __setMiddle(name: string, value: any): void
20
20
  __getMiddle(name: string): any
@@ -22,6 +22,11 @@ export interface IDataProcessor extends IObject {
22
22
  destroy(): void
23
23
  }
24
24
 
25
+ export interface ILeafDataOptions {
26
+ attrs?: 'all' | string[]
27
+ children?: boolean
28
+ }
29
+
25
30
  export interface ILeafData extends IDataProcessor, ILeafComputedData {
26
31
 
27
32
  }
@@ -15,7 +15,8 @@ import { ILeafLayout, ILayoutBoundsType, ILayoutLocationType } from '../layout/I
15
15
  import { ILeafHit } from './module/ILeafHit'
16
16
  import { ILeafRender } from './module/ILeafRender'
17
17
  import { ILeafMask } from './module/ILeafMask'
18
- import { ILeafData } from '../data/ILeafData'
18
+ import { ILeafData, ILeafDataOptions } from '../data/ILeafData'
19
+ import { IFindMethod } from '../selector/ISelector'
19
20
 
20
21
 
21
22
  export interface ICachedLeaf {
@@ -57,6 +58,7 @@ export interface ILeafAttrData {
57
58
  hittable: __Boolean
58
59
  hitFill: IHitType
59
60
  hitStroke: IHitType
61
+ hitBox: __Boolean
60
62
  hitChildren: __Boolean
61
63
  hitSelf: __Boolean
62
64
  hitRadius: __Number
@@ -184,6 +186,7 @@ export interface ILeafInputData extends IObject {
184
186
  hittable?: __Boolean
185
187
  hitFill?: IHitType
186
188
  hitStroke?: IHitType
189
+ hitBox?: __Boolean
187
190
  hitChildren?: __Boolean
188
191
  hitSelf?: __Boolean
189
192
  hitRadius?: __Number
@@ -223,6 +226,7 @@ export interface ILeafComputedData {
223
226
  hittable?: boolean
224
227
  hitFill?: IHitType
225
228
  hitStroke?: IHitType
229
+ hitBox?: boolean
226
230
  hitChildren?: boolean
227
231
  hitSelf?: boolean
228
232
  hitRadius?: number
@@ -253,6 +257,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
253
257
  isBranchLeaf?: boolean
254
258
 
255
259
  __: ILeafData
260
+ proxyData?: ILeafInputData
261
+
256
262
  __layout: ILeafLayout
257
263
 
258
264
  __world: IMatrixWithLayoutData
@@ -299,12 +305,19 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
299
305
  __bindLeafer(leafer: ILeafer | null): void
300
306
 
301
307
  set(data: IObject): void
308
+ get(options?: ILeafDataOptions): ILeafInputData
302
309
  toJSON(): IObject
303
310
  toString(): string
304
311
 
305
312
  // ILeafData ->
306
313
  __setAttr(attrName: string, newValue: __Value): void
307
314
  __getAttr(attrName: string): __Value
315
+ setProxyAttr(name: string, newValue: __Value): void
316
+ getProxyAttr(name: string): __Value
317
+
318
+ // find
319
+ find(condition: number | string | IFindMethod): ILeaf[]
320
+ findOne(condition: number | string | IFindMethod): ILeaf
308
321
 
309
322
  forceUpdate(attrName?: string): void
310
323
 
@@ -333,7 +346,7 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
333
346
  // IBranchMask ->
334
347
  __updateEraser(value?: boolean): void
335
348
  __updateMask(value?: boolean): void
336
- __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
349
+ __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void
337
350
  __removeMask(child?: ILeaf): void
338
351
 
339
352
  // convert
@@ -6,5 +6,7 @@ export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
6
6
  export interface ILeafDataProxy {
7
7
  __setAttr?(name: string, newValue: __Value): void
8
8
  __getAttr?(name: string): __Value
9
+ setProxyAttr?(name: string, newValue: __Value): void
10
+ getProxyAttr?(name: string): __Value
9
11
  }
10
12
 
@@ -6,7 +6,7 @@ export type ILeafMaskModule = ILeafMask & ThisType<ILeaf>
6
6
  export interface ILeafMask {
7
7
  __updateEraser?(value?: boolean): void
8
8
  __updateMask?(value?: boolean): void
9
- __renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
9
+ __renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void
10
10
  __removeMask?(child?: ILeaf): void
11
11
  }
12
12
 
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
6
6
 
7
7
 
8
- export { ILeafData, IDataProcessor } from './data/ILeafData'
8
+ export { ILeafData, IDataProcessor, ILeafDataOptions } from './data/ILeafData'
9
9
  export { ILeafLayout, ILayoutLocationType, ILayoutBoundsType } from './layout/ILeafLayout'
10
10
 
11
11
  export { ILeafDataProxy, ILeafDataProxyModule } from './display/module/ILeafDataProxy'
@@ -20,7 +20,7 @@ export { IBranchRender, IBranchRenderModule } from './display/module/IBranchRend
20
20
  export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'
21
21
  export { IWatcher, IWatchEventData, IWatcherConfig } from './watcher/IWatcher'
22
22
  export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
23
- export { ISelector, ISelectorConfig, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
23
+ export { ISelector, ISelectorConfig, IFindMethod, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
24
24
 
25
25
  export { ICanvasManager } from './canvas/ICanvasManager'
26
26
  export { IHitCanvasManager } from './canvas/IHitCanvasManager'
@@ -35,7 +35,7 @@ export { IPlugin } from './plugin/IPlugin'
35
35
 
36
36
 
37
37
  export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasConfig, IHitCanvasConfig, IBlobFunction, IBlob } from './canvas/ILeaferCanvas'
38
- export { ISkiaCanvas, ISkiaCanvasExportConfig, ICanvasType } from './canvas/ISkiaCanvas'
38
+ export { ISkiaCanvas, ISkiaCanvasExportConfig, ICanvasType, ISkiaNAPICanvas } from './canvas/ISkiaCanvas'
39
39
  export { IPathDrawer, IPathCreator } from './path/IPathDrawer'
40
40
  export { IWindingRule, ICanvasContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'
41
41
  export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
@@ -83,7 +83,7 @@ export interface IMoveConfig {
83
83
  }
84
84
 
85
85
  export interface IWheelConfig {
86
- zoomMode?: boolean
86
+ zoomMode?: boolean | 'mouse'
87
87
  zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
88
88
  moveSpeed?: number
89
89
  rotateSpeed?: number // 取值范围 0 ~ 1, 默认0.5
package/src/math/IMath.ts CHANGED
@@ -57,6 +57,7 @@ export interface IBounds extends IBoundsData {
57
57
  clone(): IBounds
58
58
 
59
59
  scale(scaleX: number, scaleY?: number): IBounds
60
+ scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds
60
61
  toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds
61
62
  getFitMatrix(put: IBoundsData): IMatrix
62
63
 
@@ -4,12 +4,14 @@ import { ILeaf } from '../display/ILeaf'
4
4
  import { IExportFileType, IExportImageType } from '../file/IFileType'
5
5
  import { IBoundsData, ISizeData } from '../math/IMath'
6
6
  import { IObject } from '../data/IData'
7
+ import { ICanvasType } from '../canvas/ISkiaCanvas'
7
8
 
8
9
  export interface IPlatform {
9
10
  name?: 'web' | 'node' | 'miniapp'
10
11
  os?: 'Mac' | 'Windows' | 'Linux'
11
12
  requestRender?(render: IFunction): void
12
13
  canvas?: ILeaferCanvas
14
+ canvasType?: ICanvasType
13
15
  isWorker?: boolean
14
16
  isMobile?: boolean
15
17
  devicePixelRatio?: number
@@ -28,6 +30,8 @@ export interface IPlatform {
28
30
  loadImage(url: string): Promise<any>
29
31
  noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
30
32
  },
33
+ roundRectPatch?: boolean // fix: skia-canvas roundRect
34
+ ellipseToCurve?: boolean, // fix: skia 绘制圆环和椭圆弧
31
35
  event?: {
32
36
  stopDefault(origin: IObject): void
33
37
  stopNow(origin: IObject): void
@@ -19,6 +19,10 @@ export interface ISelectorConfig {
19
19
 
20
20
  }
21
21
 
22
+ export interface IFindMethod {
23
+ (leaf: ILeaf, options?: any): any
24
+ }
25
+
22
26
  export interface ISelector {
23
27
  target: ILeaf
24
28
 
@@ -28,10 +32,11 @@ export interface ISelector {
28
32
 
29
33
  getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult
30
34
 
31
- find(name: number | string, branch?: ILeaf): ILeaf | ILeaf[]
32
- getByInnerId(name: number, branch?: ILeaf): ILeaf
33
- getById(name: string, branch?: ILeaf): ILeaf
34
- getByClassName(name: string, branch?: ILeaf): ILeaf[]
35
- getByTagName(name: string, branch?: ILeaf): ILeaf[]
35
+ getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[]
36
+ getByInnerId(innerId: number, branch?: ILeaf): ILeaf
37
+ getById(id: string, branch?: ILeaf): ILeaf
38
+ getByClassName(className: string, branch?: ILeaf): ILeaf[]
39
+ getByTag(tag: string, branch?: ILeaf): ILeaf[]
40
+ getByMethod(method: IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[]
36
41
  destroy(): void
37
42
  }
package/types/index.d.ts CHANGED
@@ -133,6 +133,7 @@ interface IBounds extends IBoundsData {
133
133
  copy(bounds: IBoundsData): IBounds;
134
134
  clone(): IBounds;
135
135
  scale(scaleX: number, scaleY?: number): IBounds;
136
+ scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds;
136
137
  toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
137
138
  getFitMatrix(put: IBoundsData): IMatrix;
138
139
  spread(spreadX: number, spreadY?: number): IBounds;
@@ -909,6 +910,8 @@ type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>;
909
910
  interface ILeafDataProxy {
910
911
  __setAttr?(name: string, newValue: __Value): void;
911
912
  __getAttr?(name: string): __Value;
913
+ setProxyAttr?(name: string, newValue: __Value): void;
914
+ getProxyAttr?(name: string): __Value;
912
915
  }
913
916
 
914
917
  type ILeafMatrixModule = ILeafMatrix & ThisType<ILeaf>;
@@ -1005,7 +1008,7 @@ type ILeafMaskModule = ILeafMask & ThisType<ILeaf>;
1005
1008
  interface ILeafMask {
1006
1009
  __updateEraser?(value?: boolean): void;
1007
1010
  __updateMask?(value?: boolean): void;
1008
- __renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void;
1011
+ __renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void;
1009
1012
  __removeMask?(child?: ILeaf): void;
1010
1013
  }
1011
1014
 
@@ -1019,14 +1022,48 @@ interface IDataProcessor extends IObject {
1019
1022
  __setInput(name: string, value: any): void;
1020
1023
  __getInput(name: string): any;
1021
1024
  __removeInput(name: string): void;
1022
- __getInputData(): IObject;
1025
+ __getInputData(options?: ILeafDataOptions): IObject;
1023
1026
  __setMiddle(name: string, value: any): void;
1024
1027
  __getMiddle(name: string): any;
1025
1028
  destroy(): void;
1026
1029
  }
1030
+ interface ILeafDataOptions {
1031
+ attrs?: 'all' | string[];
1032
+ children?: boolean;
1033
+ }
1027
1034
  interface ILeafData extends IDataProcessor, ILeafComputedData {
1028
1035
  }
1029
1036
 
1037
+ interface ISelectPathResult {
1038
+ leaf: ILeaf;
1039
+ path: ILeafList;
1040
+ throughPath?: ILeafList;
1041
+ }
1042
+ interface ISelectPathOptions {
1043
+ name?: string;
1044
+ through?: boolean;
1045
+ exclude?: ILeafList;
1046
+ ignoreHittable?: boolean;
1047
+ }
1048
+ interface ISelectorConfig {
1049
+ }
1050
+ interface IFindMethod {
1051
+ (leaf: ILeaf, options?: any): any;
1052
+ }
1053
+ interface ISelector {
1054
+ target: ILeaf;
1055
+ list: ILeafList;
1056
+ config: ISelectorConfig;
1057
+ getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult;
1058
+ getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
1059
+ getByInnerId(innerId: number, branch?: ILeaf): ILeaf;
1060
+ getById(id: string, branch?: ILeaf): ILeaf;
1061
+ getByClassName(className: string, branch?: ILeaf): ILeaf[];
1062
+ getByTag(tag: string, branch?: ILeaf): ILeaf[];
1063
+ getByMethod(method: IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
1064
+ destroy(): void;
1065
+ }
1066
+
1030
1067
  interface ICachedLeaf {
1031
1068
  canvas: ILeaferCanvas;
1032
1069
  matrix?: IMatrix;
@@ -1057,6 +1094,7 @@ interface ILeafAttrData {
1057
1094
  hittable: __Boolean;
1058
1095
  hitFill: IHitType;
1059
1096
  hitStroke: IHitType;
1097
+ hitBox: __Boolean;
1060
1098
  hitChildren: __Boolean;
1061
1099
  hitSelf: __Boolean;
1062
1100
  hitRadius: __Number;
@@ -1101,6 +1139,7 @@ interface ILeafInputData extends IObject {
1101
1139
  hittable?: __Boolean;
1102
1140
  hitFill?: IHitType;
1103
1141
  hitStroke?: IHitType;
1142
+ hitBox?: __Boolean;
1104
1143
  hitChildren?: __Boolean;
1105
1144
  hitSelf?: __Boolean;
1106
1145
  hitRadius?: __Number;
@@ -1131,6 +1170,7 @@ interface ILeafComputedData {
1131
1170
  hittable?: boolean;
1132
1171
  hitFill?: IHitType;
1133
1172
  hitStroke?: IHitType;
1173
+ hitBox?: boolean;
1134
1174
  hitChildren?: boolean;
1135
1175
  hitSelf?: boolean;
1136
1176
  hitRadius?: number;
@@ -1153,6 +1193,7 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1153
1193
  isBranch?: boolean;
1154
1194
  isBranchLeaf?: boolean;
1155
1195
  __: ILeafData;
1196
+ proxyData?: ILeafInputData;
1156
1197
  __layout: ILeafLayout;
1157
1198
  __world: IMatrixWithLayoutData;
1158
1199
  __local: IMatrixWithBoundsData;
@@ -1183,10 +1224,15 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1183
1224
  nextRender(item: IFunction): void;
1184
1225
  __bindLeafer(leafer: ILeafer | null): void;
1185
1226
  set(data: IObject): void;
1227
+ get(options?: ILeafDataOptions): ILeafInputData;
1186
1228
  toJSON(): IObject;
1187
1229
  toString(): string;
1188
1230
  __setAttr(attrName: string, newValue: __Value): void;
1189
1231
  __getAttr(attrName: string): __Value;
1232
+ setProxyAttr(name: string, newValue: __Value): void;
1233
+ getProxyAttr(name: string): __Value;
1234
+ find(condition: number | string | IFindMethod): ILeaf[];
1235
+ findOne(condition: number | string | IFindMethod): ILeaf;
1190
1236
  forceUpdate(attrName?: string): void;
1191
1237
  __updateWorldMatrix(): void;
1192
1238
  __updateLocalMatrix(): void;
@@ -1203,7 +1249,7 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1203
1249
  __onUpdateSize(): void;
1204
1250
  __updateEraser(value?: boolean): void;
1205
1251
  __updateMask(value?: boolean): void;
1206
- __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void;
1252
+ __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void;
1207
1253
  __removeMask(child?: ILeaf): void;
1208
1254
  getWorld(attrName: IMatrixDecompositionAttr): number;
1209
1255
  getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData;
@@ -1241,32 +1287,6 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
1241
1287
  remove(child?: ILeaf, destroy?: boolean): void;
1242
1288
  }
1243
1289
 
1244
- interface ISelectPathResult {
1245
- leaf: ILeaf;
1246
- path: ILeafList;
1247
- throughPath?: ILeafList;
1248
- }
1249
- interface ISelectPathOptions {
1250
- name?: string;
1251
- through?: boolean;
1252
- exclude?: ILeafList;
1253
- ignoreHittable?: boolean;
1254
- }
1255
- interface ISelectorConfig {
1256
- }
1257
- interface ISelector {
1258
- target: ILeaf;
1259
- list: ILeafList;
1260
- config: ISelectorConfig;
1261
- getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult;
1262
- find(name: number | string, branch?: ILeaf): ILeaf | ILeaf[];
1263
- getByInnerId(name: number, branch?: ILeaf): ILeaf;
1264
- getById(name: string, branch?: ILeaf): ILeaf;
1265
- getByClassName(name: string, branch?: ILeaf): ILeaf[];
1266
- getByTagName(name: string, branch?: ILeaf): ILeaf[];
1267
- destroy(): void;
1268
- }
1269
-
1270
1290
  type IExportImageType = 'jpg' | 'png' | 'webp';
1271
1291
  type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json';
1272
1292
 
@@ -1417,7 +1437,7 @@ interface IMoveConfig {
1417
1437
  autoDistance?: number;
1418
1438
  }
1419
1439
  interface IWheelConfig {
1420
- zoomMode?: boolean;
1440
+ zoomMode?: boolean | 'mouse';
1421
1441
  zoomSpeed?: number;
1422
1442
  moveSpeed?: number;
1423
1443
  rotateSpeed?: number;
@@ -1593,11 +1613,41 @@ interface IImageManager {
1593
1613
  destroy(): void;
1594
1614
  }
1595
1615
 
1616
+ type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx';
1617
+ interface ISkiaCanvas {
1618
+ toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
1619
+ toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
1620
+ toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
1621
+ toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
1622
+ saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
1623
+ saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
1624
+ }
1625
+ interface ISkiaCanvasExportConfig {
1626
+ page?: number;
1627
+ matte?: string;
1628
+ density?: number;
1629
+ quality?: number;
1630
+ outline?: boolean;
1631
+ }
1632
+ interface ISkiaNAPICanvas {
1633
+ encodeSync(format: 'webp' | 'jpeg', quality?: number): any;
1634
+ encodeSync(format: 'png'): any;
1635
+ encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>;
1636
+ encode(format: 'png'): Promise<any>;
1637
+ toBuffer(mime: 'image/png'): any;
1638
+ toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any;
1639
+ toDataURL(mime?: 'image/png'): string;
1640
+ toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string;
1641
+ toDataURLAsync(mime?: 'image/png'): Promise<string>;
1642
+ toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>;
1643
+ }
1644
+
1596
1645
  interface IPlatform {
1597
1646
  name?: 'web' | 'node' | 'miniapp';
1598
1647
  os?: 'Mac' | 'Windows' | 'Linux';
1599
1648
  requestRender?(render: IFunction): void;
1600
1649
  canvas?: ILeaferCanvas;
1650
+ canvasType?: ICanvasType;
1601
1651
  isWorker?: boolean;
1602
1652
  isMobile?: boolean;
1603
1653
  devicePixelRatio?: number;
@@ -1616,6 +1666,8 @@ interface IPlatform {
1616
1666
  loadImage(url: string): Promise<any>;
1617
1667
  noRepeat?: string;
1618
1668
  };
1669
+ roundRectPatch?: boolean;
1670
+ ellipseToCurve?: boolean;
1619
1671
  event?: {
1620
1672
  stopDefault(origin: IObject): void;
1621
1673
  stopNow(origin: IObject): void;
@@ -1646,21 +1698,4 @@ interface IPlugin extends IObject {
1646
1698
  onLeafer?(leafer: ILeafer): void;
1647
1699
  }
1648
1700
 
1649
- type ICanvasType = 'skia' | 'canvas' | 'wx';
1650
- interface ISkiaCanvas {
1651
- toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
1652
- toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
1653
- toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
1654
- toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
1655
- saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
1656
- saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
1657
- }
1658
- interface ISkiaCanvasExportConfig {
1659
- page?: number;
1660
- matte?: string;
1661
- density?: number;
1662
- quality?: number;
1663
- outline?: boolean;
1664
- }
1665
-
1666
- export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IApp, IAround, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBooleanMap, IBounds, IBoundsData, IBoundsDataHandle, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasContext2D, ICanvasManager, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDragEvent, IDropEvent, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutBlockData, ILayoutBoundsType, ILayoutChangedData, ILayoutEvent, ILayoutLocationType, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMask, ILeafMaskModule, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeafer, ILeaferCanvas, ILeaferCanvasConfig, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, IMatrix, IMatrixData, IMatrixDecompositionAttr, IMatrixDecompositionData, IMatrixWithBoundsData, IMatrixWithLayoutData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumberMap, IObject, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPlatform, IPlugin, IPoint, IPointData, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResizeType, IRotateEvent, IScreenSizeData, ISelectPathOptions, ISelectPathResult, ISelector, ISelectorConfig, ISize, ISizeData, ISkiaCanvas, ISkiaCanvasExportConfig, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBounds, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData, __Boolean, __Number, __Object, __String, __Value };
1701
+ export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IApp, IAround, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBooleanMap, IBounds, IBoundsData, IBoundsDataHandle, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasContext2D, ICanvasManager, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDragEvent, IDropEvent, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IFindMethod, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutBlockData, ILayoutBoundsType, ILayoutChangedData, ILayoutEvent, ILayoutLocationType, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMask, ILeafMaskModule, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeafer, ILeaferCanvas, ILeaferCanvasConfig, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, IMatrix, IMatrixData, IMatrixDecompositionAttr, IMatrixDecompositionData, IMatrixWithBoundsData, IMatrixWithLayoutData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumberMap, IObject, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPlatform, IPlugin, IPoint, IPointData, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResizeType, IRotateEvent, IScreenSizeData, ISelectPathOptions, ISelectPathResult, ISelector, ISelectorConfig, ISize, ISizeData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBounds, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData, __Boolean, __Number, __Object, __String, __Value };