@nmmty/lazycanvas 0.6.0-dev.f33019 → 0.6.1
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/helpers/Utlis.d.ts +28 -0
- package/dist/helpers/Utlis.js +78 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +19 -0
- package/dist/index.d.ts +5 -10
- package/dist/index.js +5 -29
- package/dist/structures/LazyCanvas.d.ts +46 -13
- package/dist/structures/LazyCanvas.js +66 -22
- package/dist/structures/components/BaseLayer.d.ts +16 -16
- package/dist/structures/components/BaseLayer.js +17 -17
- package/dist/structures/components/BezierLayer.d.ts +21 -21
- package/dist/structures/components/BezierLayer.js +20 -20
- package/dist/structures/components/ClearLayer.d.ts +15 -15
- package/dist/structures/components/ClearLayer.js +14 -14
- package/dist/structures/components/Group.d.ts +10 -11
- package/dist/structures/components/Group.js +9 -10
- package/dist/structures/components/ImageLayer.d.ts +12 -14
- package/dist/structures/components/ImageLayer.js +11 -11
- package/dist/structures/components/LineLayer.d.ts +20 -20
- package/dist/structures/components/LineLayer.js +19 -19
- package/dist/structures/components/MorphLayer.d.ts +18 -24
- package/dist/structures/components/MorphLayer.js +18 -26
- package/dist/structures/components/Path2DLayer.d.ts +4 -78
- package/dist/structures/components/Path2DLayer.js +2 -116
- package/dist/structures/components/QuadraticLayer.d.ts +22 -22
- package/dist/structures/components/QuadraticLayer.js +21 -21
- package/dist/structures/components/TextLayer.d.ts +37 -43
- package/dist/structures/components/TextLayer.js +37 -45
- package/dist/structures/helpers/Exporter.d.ts +9 -11
- package/dist/structures/helpers/Exporter.js +49 -32
- package/dist/structures/helpers/Font.d.ts +4 -6
- package/dist/structures/helpers/Font.js +4 -4
- package/dist/structures/helpers/Gradient.d.ts +15 -10
- package/dist/structures/helpers/Gradient.js +14 -9
- package/dist/structures/helpers/Link.d.ts +5 -5
- package/dist/structures/helpers/Link.js +5 -5
- package/dist/structures/helpers/Pattern.d.ts +5 -5
- package/dist/structures/helpers/Pattern.js +5 -5
- package/dist/structures/helpers/index.d.ts +7 -7
- package/dist/structures/helpers/readers/JSONReader.d.ts +12 -12
- package/dist/structures/helpers/readers/JSONReader.js +29 -19
- package/dist/structures/helpers/readers/YAMLReader.d.ts +4 -4
- package/dist/structures/helpers/readers/YAMLReader.js +21 -11
- package/dist/structures/managers/AnimationManager.d.ts +11 -11
- package/dist/structures/managers/AnimationManager.js +11 -11
- package/dist/structures/managers/FontsManager.d.ts +14 -15
- package/dist/structures/managers/FontsManager.js +14 -15
- package/dist/structures/managers/LayersManager.d.ts +22 -12
- package/dist/structures/managers/LayersManager.js +27 -12
- package/dist/structures/managers/PluginManager.d.ts +230 -0
- package/dist/structures/managers/PluginManager.js +182 -0
- package/dist/structures/managers/RenderManager.d.ts +10 -12
- package/dist/structures/managers/RenderManager.js +31 -16
- package/dist/structures/managers/index.d.ts +5 -0
- package/dist/structures/managers/index.js +21 -0
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js +15 -16
- package/package.json +59 -56
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
|
|
4
2
|
import { ScaleType, LayerType, radiusCorner } from "../../types";
|
|
5
3
|
import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
|
|
6
|
-
import { LayersManager } from "../managers
|
|
4
|
+
import { LayersManager } from "../managers";
|
|
7
5
|
/**
|
|
8
6
|
* Interface representing an Image Layer.
|
|
9
7
|
*/
|
|
@@ -55,22 +53,22 @@ export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
|
|
|
55
53
|
props: IImageLayerProps;
|
|
56
54
|
/**
|
|
57
55
|
* Constructs a new ImageLayer instance.
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
56
|
+
* @param {IImageLayerProps} [props] - The properties of the Image Layer.
|
|
57
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
60
58
|
*/
|
|
61
59
|
constructor(props?: IImageLayerProps, misc?: IBaseLayerMisc);
|
|
62
60
|
/**
|
|
63
61
|
* Sets the source of the image.
|
|
64
|
-
* @param
|
|
62
|
+
* @param {string} [src] - The source of the image, which can be a URL or file path.
|
|
65
63
|
* @returns {this} The current instance for chaining.
|
|
66
64
|
* @throws {LazyError} If the source is not a valid URL.
|
|
67
65
|
*/
|
|
68
66
|
setSrc(src: string): this;
|
|
69
67
|
/**
|
|
70
68
|
* Sets the size of the image.
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
69
|
+
* @param {ScaleType} [width] - The width of the image.
|
|
70
|
+
* @param {ScaleType} [height] - The height of the image.
|
|
71
|
+
* @param {{ [corner in radiusCorner]?: ScaleType }} [radius] - The radius of the image (optional).
|
|
74
72
|
* @returns {this} The current instance for chaining.
|
|
75
73
|
*/
|
|
76
74
|
setSize(width: ScaleType, height: ScaleType, radius?: {
|
|
@@ -78,10 +76,10 @@ export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
|
|
|
78
76
|
}): this;
|
|
79
77
|
/**
|
|
80
78
|
* Draws the Image Layer on the canvas.
|
|
81
|
-
* @param
|
|
82
|
-
* @param
|
|
83
|
-
* @param
|
|
84
|
-
* @param
|
|
79
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
80
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
81
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
82
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
85
83
|
* @throws {LazyError} If the image could not be loaded.
|
|
86
84
|
*/
|
|
87
85
|
draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
@@ -92,7 +90,7 @@ export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
|
|
|
92
90
|
toJSON(): IImageLayer;
|
|
93
91
|
/**
|
|
94
92
|
* Validates the properties of the Image Layer.
|
|
95
|
-
* @param
|
|
93
|
+
* @param {IImageLayerProps} [data] - The properties to validate.
|
|
96
94
|
* @returns {IImageLayerProps} The validated properties.
|
|
97
95
|
*/
|
|
98
96
|
protected validateProps(data: IImageLayerProps): IImageLayerProps;
|
|
@@ -17,8 +17,8 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
17
17
|
props;
|
|
18
18
|
/**
|
|
19
19
|
* Constructs a new ImageLayer instance.
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
20
|
+
* @param {IImageLayerProps} [props] - The properties of the Image Layer.
|
|
21
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
22
22
|
*/
|
|
23
23
|
constructor(props, misc) {
|
|
24
24
|
super(types_1.LayerType.Image, props || {}, misc);
|
|
@@ -27,7 +27,7 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Sets the source of the image.
|
|
30
|
-
* @param
|
|
30
|
+
* @param {string} [src] - The source of the image, which can be a URL or file path.
|
|
31
31
|
* @returns {this} The current instance for chaining.
|
|
32
32
|
* @throws {LazyError} If the source is not a valid URL.
|
|
33
33
|
*/
|
|
@@ -39,9 +39,9 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Sets the size of the image.
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
42
|
+
* @param {ScaleType} [width] - The width of the image.
|
|
43
|
+
* @param {ScaleType} [height] - The height of the image.
|
|
44
|
+
* @param {{ [corner in radiusCorner]?: ScaleType }} [radius] - The radius of the image (optional).
|
|
45
45
|
* @returns {this} The current instance for chaining.
|
|
46
46
|
*/
|
|
47
47
|
setSize(width, height, radius) {
|
|
@@ -54,10 +54,10 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Draws the Image Layer on the canvas.
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
57
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
58
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
59
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
60
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
61
61
|
* @throws {LazyError} If the image could not be loaded.
|
|
62
62
|
*/
|
|
63
63
|
async draw(ctx, canvas, manager, debug) {
|
|
@@ -120,7 +120,7 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* Validates the properties of the Image Layer.
|
|
123
|
-
* @param
|
|
123
|
+
* @param {IImageLayerProps} [data] - The properties to validate.
|
|
124
124
|
* @returns {IImageLayerProps} The validated properties.
|
|
125
125
|
*/
|
|
126
126
|
validateProps(data) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
|
|
2
2
|
import { ColorType, ScaleType, LayerType } from "../../types";
|
|
3
3
|
import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
|
|
4
|
-
import { LayersManager } from "../managers
|
|
4
|
+
import { LayersManager } from "../managers";
|
|
5
5
|
/**
|
|
6
6
|
* Interface representing a Line Layer.
|
|
7
7
|
*/
|
|
@@ -72,40 +72,40 @@ export declare class LineLayer extends BaseLayer<ILineLayerProps> {
|
|
|
72
72
|
props: ILineLayerProps;
|
|
73
73
|
/**
|
|
74
74
|
* Constructs a new LineLayer instance.
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
75
|
+
* @param {ILineLayerProps} [props] - The properties of the Line Layer.
|
|
76
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
77
77
|
*/
|
|
78
78
|
constructor(props?: ILineLayerProps, misc?: IBaseLayerMisc);
|
|
79
79
|
/**
|
|
80
80
|
* Sets the end position of the line layer.
|
|
81
|
-
* @param
|
|
82
|
-
* @param
|
|
81
|
+
* @param {ScaleType} [x] - The x-coordinate of the end point.
|
|
82
|
+
* @param {ScaleType} [y] - The y-coordinate of the end point.
|
|
83
83
|
* @returns {this} The current instance for chaining.
|
|
84
84
|
*/
|
|
85
85
|
setEndPosition(x: ScaleType, y: ScaleType): this;
|
|
86
86
|
/**
|
|
87
87
|
* Sets the color of the line layer.
|
|
88
|
-
* @param
|
|
88
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
89
89
|
* @returns {this} The current instance for chaining.
|
|
90
90
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
91
91
|
*/
|
|
92
92
|
setColor(color: ColorType): this;
|
|
93
93
|
/**
|
|
94
94
|
* Sets the stroke properties of the line layer.
|
|
95
|
-
* @param
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
98
|
-
* @param
|
|
99
|
-
* @param
|
|
100
|
-
* @param
|
|
95
|
+
* @param {number} [width] - The width of the stroke.
|
|
96
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
97
|
+
* @param {string} [join] - The join style of the stroke.
|
|
98
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
99
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
100
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
101
101
|
* @returns {this} The current instance for chaining.
|
|
102
102
|
*/
|
|
103
103
|
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
|
|
104
104
|
/**
|
|
105
105
|
* Calculates the bounding box of the line layer.
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @param
|
|
106
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
107
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
108
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
109
109
|
* @returns {Object} The bounding box details including start and end points, width, and height.
|
|
110
110
|
*/
|
|
111
111
|
getBoundingBox(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager): {
|
|
@@ -118,10 +118,10 @@ export declare class LineLayer extends BaseLayer<ILineLayerProps> {
|
|
|
118
118
|
};
|
|
119
119
|
/**
|
|
120
120
|
* Draws the line layer on the canvas.
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
121
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
122
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
123
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
124
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
125
125
|
*/
|
|
126
126
|
draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
127
127
|
/**
|
|
@@ -131,7 +131,7 @@ export declare class LineLayer extends BaseLayer<ILineLayerProps> {
|
|
|
131
131
|
toJSON(): ILineLayer;
|
|
132
132
|
/**
|
|
133
133
|
* Validates the properties of the Line Layer.
|
|
134
|
-
* @param
|
|
134
|
+
* @param {ILineLayerProps} [data] - The properties to validate.
|
|
135
135
|
* @returns {ILineLayerProps} The validated properties.
|
|
136
136
|
*/
|
|
137
137
|
protected validateProps(data: ILineLayerProps): ILineLayerProps;
|
|
@@ -15,8 +15,8 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
15
15
|
props;
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a new LineLayer instance.
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
18
|
+
* @param {ILineLayerProps} [props] - The properties of the Line Layer.
|
|
19
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
20
20
|
*/
|
|
21
21
|
constructor(props, misc) {
|
|
22
22
|
super(types_1.LayerType.Line, props || {}, misc);
|
|
@@ -25,8 +25,8 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Sets the end position of the line layer.
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
28
|
+
* @param {ScaleType} [x] - The x-coordinate of the end point.
|
|
29
|
+
* @param {ScaleType} [y] - The y-coordinate of the end point.
|
|
30
30
|
* @returns {this} The current instance for chaining.
|
|
31
31
|
*/
|
|
32
32
|
setEndPosition(x, y) {
|
|
@@ -35,7 +35,7 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Sets the color of the line layer.
|
|
38
|
-
* @param
|
|
38
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
39
39
|
* @returns {this} The current instance for chaining.
|
|
40
40
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
41
41
|
*/
|
|
@@ -49,12 +49,12 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Sets the stroke properties of the line layer.
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
52
|
+
* @param {number} [width] - The width of the stroke.
|
|
53
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
54
|
+
* @param {string} [join] - The join style of the stroke.
|
|
55
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
56
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
57
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
58
58
|
* @returns {this} The current instance for chaining.
|
|
59
59
|
*/
|
|
60
60
|
setStroke(width, cap, join, dash, dashOffset, miterLimit) {
|
|
@@ -70,9 +70,9 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Calculates the bounding box of the line layer.
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
73
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
74
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
75
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
76
76
|
* @returns {Object} The bounding box details including start and end points, width, and height.
|
|
77
77
|
*/
|
|
78
78
|
getBoundingBox(ctx, canvas, manager) {
|
|
@@ -89,10 +89,10 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Draws the line layer on the canvas.
|
|
92
|
-
* @param
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
95
|
-
* @param
|
|
92
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
93
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
94
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
95
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
96
96
|
*/
|
|
97
97
|
async draw(ctx, canvas, manager, debug) {
|
|
98
98
|
const parcer = (0, utils_1.parser)(ctx, canvas, manager);
|
|
@@ -142,7 +142,7 @@ class LineLayer extends BaseLayer_1.BaseLayer {
|
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* Validates the properties of the Line Layer.
|
|
145
|
-
* @param
|
|
145
|
+
* @param {ILineLayerProps} [data] - The properties to validate.
|
|
146
146
|
* @returns {ILineLayerProps} The validated properties.
|
|
147
147
|
*/
|
|
148
148
|
validateProps(data) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
|
|
2
2
|
import { ColorType, ScaleType, LayerType, radiusCorner } from "../../types";
|
|
3
3
|
import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
|
|
4
|
-
import { LayersManager } from "../managers
|
|
4
|
+
import { LayersManager } from "../managers";
|
|
5
5
|
/**
|
|
6
6
|
* Interface representing a Morph Layer.
|
|
7
7
|
*/
|
|
@@ -78,15 +78,15 @@ export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
|
|
|
78
78
|
props: IMorphLayerProps;
|
|
79
79
|
/**
|
|
80
80
|
* Constructs a new MorphLayer instance.
|
|
81
|
-
* @param
|
|
82
|
-
* @param
|
|
81
|
+
* @param {IMorphLayerProps} [props] - The properties of the Morph Layer.
|
|
82
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
83
83
|
*/
|
|
84
84
|
constructor(props?: IMorphLayerProps, misc?: IBaseLayerMisc);
|
|
85
85
|
/**
|
|
86
86
|
* Sets the size of the Morph Layer.
|
|
87
|
-
* @param
|
|
88
|
-
* @param
|
|
89
|
-
* @param
|
|
87
|
+
* @param {ScaleType} [width] - The width of the Morph Layer.
|
|
88
|
+
* @param {ScaleType} [height] - The height of the Morph Layer.
|
|
89
|
+
* @param {{ [corner in radiusCorner]?: ScaleType }} [radius] - The radius of the Morph Layer (optional).
|
|
90
90
|
* @returns {this} The current instance for chaining.
|
|
91
91
|
*/
|
|
92
92
|
setSize(width: ScaleType, height: ScaleType, radius?: {
|
|
@@ -94,34 +94,28 @@ export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
|
|
|
94
94
|
}): this;
|
|
95
95
|
/**
|
|
96
96
|
* Sets the color of the Morph Layer.
|
|
97
|
-
* @param
|
|
97
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
98
98
|
* @returns {this} The current instance for chaining.
|
|
99
99
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
100
100
|
*/
|
|
101
101
|
setColor(color: ColorType): this;
|
|
102
102
|
/**
|
|
103
103
|
* Sets the stroke properties of the Morph Layer.
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
104
|
+
* @param {number} [width] - The width of the stroke.
|
|
105
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
106
|
+
* @param {string} [join] - The join style of the stroke.
|
|
107
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
108
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
109
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
110
110
|
* @returns {this} The current instance for chaining.
|
|
111
111
|
*/
|
|
112
112
|
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
|
|
113
|
-
/**
|
|
114
|
-
* Sets whether the Morph Layer should be filled or stroked.
|
|
115
|
-
* @param filled {boolean} - If true, the layer will be filled; otherwise, it will be stroked.
|
|
116
|
-
* @returns {this} The current instance for chaining.
|
|
117
|
-
*/
|
|
118
|
-
setFilled(filled: boolean): this;
|
|
119
113
|
/**
|
|
120
114
|
* Draws the Morph Layer on the canvas.
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
115
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
116
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
117
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
118
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
125
119
|
*/
|
|
126
120
|
draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
127
121
|
/**
|
|
@@ -131,7 +125,7 @@ export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
|
|
|
131
125
|
toJSON(): IMorphLayer;
|
|
132
126
|
/**
|
|
133
127
|
* Validates the properties of the Morph Layer.
|
|
134
|
-
* @param
|
|
128
|
+
* @param {IMorphLayerProps} [data] - The properties to validate.
|
|
135
129
|
* @returns {IMorphLayerProps} The validated properties.
|
|
136
130
|
*/
|
|
137
131
|
protected validateProps(data: IMorphLayerProps): IMorphLayerProps;
|
|
@@ -16,8 +16,8 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
16
16
|
props;
|
|
17
17
|
/**
|
|
18
18
|
* Constructs a new MorphLayer instance.
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
19
|
+
* @param {IMorphLayerProps} [props] - The properties of the Morph Layer.
|
|
20
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
21
21
|
*/
|
|
22
22
|
constructor(props, misc) {
|
|
23
23
|
super(types_1.LayerType.Morph, props || {}, misc);
|
|
@@ -26,9 +26,9 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Sets the size of the Morph Layer.
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
29
|
+
* @param {ScaleType} [width] - The width of the Morph Layer.
|
|
30
|
+
* @param {ScaleType} [height] - The height of the Morph Layer.
|
|
31
|
+
* @param {{ [corner in radiusCorner]?: ScaleType }} [radius] - The radius of the Morph Layer (optional).
|
|
32
32
|
* @returns {this} The current instance for chaining.
|
|
33
33
|
*/
|
|
34
34
|
setSize(width, height, radius) {
|
|
@@ -41,7 +41,7 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Sets the color of the Morph Layer.
|
|
44
|
-
* @param
|
|
44
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
45
45
|
* @returns {this} The current instance for chaining.
|
|
46
46
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
47
47
|
*/
|
|
@@ -55,12 +55,12 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Sets the stroke properties of the Morph Layer.
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
58
|
+
* @param {number} [width] - The width of the stroke.
|
|
59
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
60
|
+
* @param {string} [join] - The join style of the stroke.
|
|
61
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
62
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
63
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
64
64
|
* @returns {this} The current instance for chaining.
|
|
65
65
|
*/
|
|
66
66
|
setStroke(width, cap, join, dash, dashOffset, miterLimit) {
|
|
@@ -72,23 +72,15 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
72
72
|
dashOffset: dashOffset || 0,
|
|
73
73
|
miterLimit: miterLimit || 10,
|
|
74
74
|
};
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Sets whether the Morph Layer should be filled or stroked.
|
|
79
|
-
* @param filled {boolean} - If true, the layer will be filled; otherwise, it will be stroked.
|
|
80
|
-
* @returns {this} The current instance for chaining.
|
|
81
|
-
*/
|
|
82
|
-
setFilled(filled) {
|
|
83
|
-
this.props.filled = filled;
|
|
75
|
+
this.props.filled = false; // Ensure filled is false when stroke is set
|
|
84
76
|
return this;
|
|
85
77
|
}
|
|
86
78
|
/**
|
|
87
79
|
* Draws the Morph Layer on the canvas.
|
|
88
|
-
* @param
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
91
|
-
* @param
|
|
80
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
81
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
82
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
83
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
92
84
|
*/
|
|
93
85
|
async draw(ctx, canvas, manager, debug) {
|
|
94
86
|
const parcer = (0, utils_1.parser)(ctx, canvas, manager);
|
|
@@ -158,7 +150,7 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
158
150
|
}
|
|
159
151
|
/**
|
|
160
152
|
* Validates the properties of the Morph Layer.
|
|
161
|
-
* @param
|
|
153
|
+
* @param {IMorphLayerProps} [data] - The properties to validate.
|
|
162
154
|
* @returns {IMorphLayerProps} The validated properties.
|
|
163
155
|
*/
|
|
164
156
|
validateProps(data) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Canvas, DOMMatrix2DInit, FillType, Path2D, PathOp, SKRSContext2D, StrokeOptions, SvgCanvas } from "@napi-rs/canvas";
|
|
2
|
-
import {
|
|
2
|
+
import { ColorType, LayerType } from "../../types";
|
|
3
3
|
import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
|
|
4
|
-
import { LayersManager } from "../managers
|
|
4
|
+
import { LayersManager } from "../managers";
|
|
5
5
|
export interface IPath2DLayer extends IBaseLayer {
|
|
6
6
|
type: LayerType.Path;
|
|
7
7
|
props: IPath2DLayerProps;
|
|
@@ -47,83 +47,9 @@ export declare class Path2DLayer extends BaseLayer<IPath2DLayerProps> {
|
|
|
47
47
|
visible: boolean;
|
|
48
48
|
props: IPath2DLayerProps;
|
|
49
49
|
constructor(props?: IPath2DLayerProps, misc?: IBaseLayerMisc);
|
|
50
|
-
/**
|
|
51
|
-
* Sets the unique identifier of the layer.
|
|
52
|
-
*
|
|
53
|
-
* @param {string} id - The unique identifier.
|
|
54
|
-
* @returns {this} The current instance for chaining.
|
|
55
|
-
*/
|
|
56
|
-
setID(id: string): this;
|
|
57
|
-
/**
|
|
58
|
-
* Sets the visibility of the layer.
|
|
59
|
-
* @param visible {boolean} - The visibility state of the layer.
|
|
60
|
-
* @returns {this} The current instance for chaining.
|
|
61
|
-
*/
|
|
62
|
-
setVisible(visible: boolean): this;
|
|
63
|
-
/**
|
|
64
|
-
* Sets the z-index of the layer.
|
|
65
|
-
* @param zIndex {number} - The z-index value of the layer.
|
|
66
|
-
* @returns {this} The current instance for chaining.
|
|
67
|
-
*/
|
|
68
|
-
setZIndex(zIndex: number): this;
|
|
69
|
-
/**
|
|
70
|
-
* Sets the global composite operation for the layer.
|
|
71
|
-
* @param {AnyGlobalCompositeOperation} operation - The composite operation.
|
|
72
|
-
* @returns {this} The current instance for chaining.
|
|
73
|
-
*/
|
|
74
|
-
setGlobalCompositeOperation(operation: AnyGlobalCompositeOperation): this;
|
|
75
|
-
/**
|
|
76
|
-
* Sets the filter effects for the layer.
|
|
77
|
-
* @param {...AnyFilter} filter - The filter effects to apply.
|
|
78
|
-
* @returns {this} The current instance for chaining.
|
|
79
|
-
*/
|
|
80
|
-
setFilters(...filter: AnyFilter[]): this;
|
|
81
|
-
/**
|
|
82
|
-
* Sets the transformation matrix of the layer.
|
|
83
|
-
* @param {DOMMatrix2DInit} matrix - The transformation matrix.
|
|
84
|
-
* @returns {this} The current instance for chaining.
|
|
85
|
-
*/
|
|
86
|
-
setMatrix(matrix: DOMMatrix2DInit): this;
|
|
87
|
-
/**
|
|
88
|
-
* Sets the scale of the layer in the x and y directions.
|
|
89
|
-
* @param {number} x - The scale factor in the x direction.
|
|
90
|
-
* @param {number} y - The scale factor in the y direction.
|
|
91
|
-
* @returns {this} The current instance for chaining.
|
|
92
|
-
*/
|
|
93
|
-
setScale(x: number, y: number): this;
|
|
94
|
-
/**
|
|
95
|
-
* Sets the translation of the layer in the x and y directions.
|
|
96
|
-
* @param {number} x - The translation in the x direction.
|
|
97
|
-
* @param {number} y - The translation in the y direction.
|
|
98
|
-
* @returns {this} The current instance for chaining.
|
|
99
|
-
*/
|
|
100
|
-
setTranslate(x: number, y: number): this;
|
|
101
|
-
/**
|
|
102
|
-
* Sets the opacity of the layer.
|
|
103
|
-
* @param {number} opacity - The opacity value, between 0 and 1.
|
|
104
|
-
* @returns {this} The current instance for chaining.
|
|
105
|
-
*/
|
|
106
|
-
setOpacity(opacity: number): this;
|
|
107
|
-
/**
|
|
108
|
-
* Sets the stroke properties of the Path2D Layer.
|
|
109
|
-
* @param width {number} - The width of the stroke.
|
|
110
|
-
* @param cap {string} - The cap style of the stroke.
|
|
111
|
-
* @param join {string} - The join style of the stroke.
|
|
112
|
-
* @param dash {number[]} - The dash pattern of the stroke.
|
|
113
|
-
* @param dashOffset {number} - The dash offset of the stroke.
|
|
114
|
-
* @param miterLimit {number} - The miter limit of the stroke.
|
|
115
|
-
* @returns {this} The current instance for chaining.
|
|
116
|
-
*/
|
|
117
|
-
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
|
|
118
|
-
/**
|
|
119
|
-
* Sets whether the Path2D Layer should be filled or stroked.
|
|
120
|
-
* @param filled {boolean} - If true, the layer will be filled; otherwise, it will be stroked.
|
|
121
|
-
* @returns {this} The current instance for chaining.
|
|
122
|
-
*/
|
|
123
|
-
setFilled(filled: boolean): this;
|
|
124
50
|
/**
|
|
125
51
|
* Sets the color of the Path2D Layer.
|
|
126
|
-
* @param
|
|
52
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
127
53
|
* @returns {this} The current instance for chaining.
|
|
128
54
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
129
55
|
*/
|
|
@@ -163,7 +89,7 @@ export declare class Path2DLayer extends BaseLayer<IPath2DLayerProps> {
|
|
|
163
89
|
toJSON(): IPath2DLayer;
|
|
164
90
|
/**
|
|
165
91
|
* Validates the properties of the Path2D Layer.
|
|
166
|
-
* @param
|
|
92
|
+
* @param {IPath2DLayerProps} [data] - The properties to validate.
|
|
167
93
|
* @returns {IPath2DLayerProps} The validated properties.
|
|
168
94
|
*/
|
|
169
95
|
protected validateProps(data: IPath2DLayerProps): IPath2DLayerProps;
|