@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
|
@@ -20,123 +20,9 @@ class Path2DLayer extends BaseLayer_1.BaseLayer {
|
|
|
20
20
|
this.props = props ? props : {};
|
|
21
21
|
this.props = this.validateProps(this.props);
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Sets the unique identifier of the layer.
|
|
25
|
-
*
|
|
26
|
-
* @param {string} id - The unique identifier.
|
|
27
|
-
* @returns {this} The current instance for chaining.
|
|
28
|
-
*/
|
|
29
|
-
setID(id) {
|
|
30
|
-
this.id = id;
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Sets the visibility of the layer.
|
|
35
|
-
* @param visible {boolean} - The visibility state of the layer.
|
|
36
|
-
* @returns {this} The current instance for chaining.
|
|
37
|
-
*/
|
|
38
|
-
setVisible(visible) {
|
|
39
|
-
this.visible = visible;
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Sets the z-index of the layer.
|
|
44
|
-
* @param zIndex {number} - The z-index value of the layer.
|
|
45
|
-
* @returns {this} The current instance for chaining.
|
|
46
|
-
*/
|
|
47
|
-
setZIndex(zIndex) {
|
|
48
|
-
this.zIndex = zIndex;
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Sets the global composite operation for the layer.
|
|
53
|
-
* @param {AnyGlobalCompositeOperation} operation - The composite operation.
|
|
54
|
-
* @returns {this} The current instance for chaining.
|
|
55
|
-
*/
|
|
56
|
-
setGlobalCompositeOperation(operation) {
|
|
57
|
-
this.props.globalComposite = operation;
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Sets the filter effects for the layer.
|
|
62
|
-
* @param {...AnyFilter} filter - The filter effects to apply.
|
|
63
|
-
* @returns {this} The current instance for chaining.
|
|
64
|
-
*/
|
|
65
|
-
setFilters(...filter) {
|
|
66
|
-
this.props.filter = filter.join(' ');
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Sets the transformation matrix of the layer.
|
|
71
|
-
* @param {DOMMatrix2DInit} matrix - The transformation matrix.
|
|
72
|
-
* @returns {this} The current instance for chaining.
|
|
73
|
-
*/
|
|
74
|
-
setMatrix(matrix) {
|
|
75
|
-
this.props.transform = { ...this.props.transform, matrix };
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Sets the scale of the layer in the x and y directions.
|
|
80
|
-
* @param {number} x - The scale factor in the x direction.
|
|
81
|
-
* @param {number} y - The scale factor in the y direction.
|
|
82
|
-
* @returns {this} The current instance for chaining.
|
|
83
|
-
*/
|
|
84
|
-
setScale(x, y) {
|
|
85
|
-
this.props.transform = { ...this.props.transform, scale: { x, y } };
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Sets the translation of the layer in the x and y directions.
|
|
90
|
-
* @param {number} x - The translation in the x direction.
|
|
91
|
-
* @param {number} y - The translation in the y direction.
|
|
92
|
-
* @returns {this} The current instance for chaining.
|
|
93
|
-
*/
|
|
94
|
-
setTranslate(x, y) {
|
|
95
|
-
this.props.transform = { ...this.props.transform, translate: { x, y } };
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Sets the opacity of the layer.
|
|
100
|
-
* @param {number} opacity - The opacity value, between 0 and 1.
|
|
101
|
-
* @returns {this} The current instance for chaining.
|
|
102
|
-
*/
|
|
103
|
-
setOpacity(opacity) {
|
|
104
|
-
this.props.opacity = opacity;
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
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, cap, join, dash, dashOffset, miterLimit) {
|
|
118
|
-
this.props.stroke = {
|
|
119
|
-
width,
|
|
120
|
-
cap: cap || 'butt',
|
|
121
|
-
join: join || 'miter',
|
|
122
|
-
dash: dash || [],
|
|
123
|
-
dashOffset: dashOffset || 0,
|
|
124
|
-
miterLimit: miterLimit || 10,
|
|
125
|
-
};
|
|
126
|
-
return this;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Sets whether the Path2D Layer should be filled or stroked.
|
|
130
|
-
* @param filled {boolean} - If true, the layer will be filled; otherwise, it will be stroked.
|
|
131
|
-
* @returns {this} The current instance for chaining.
|
|
132
|
-
*/
|
|
133
|
-
setFilled(filled) {
|
|
134
|
-
this.props.filled = filled;
|
|
135
|
-
return this;
|
|
136
|
-
}
|
|
137
23
|
/**
|
|
138
24
|
* Sets the color of the Path2D Layer.
|
|
139
|
-
* @param
|
|
25
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
140
26
|
* @returns {this} The current instance for chaining.
|
|
141
27
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
142
28
|
*/
|
|
@@ -292,7 +178,7 @@ class Path2DLayer extends BaseLayer_1.BaseLayer {
|
|
|
292
178
|
}
|
|
293
179
|
/**
|
|
294
180
|
* Validates the properties of the Path2D Layer.
|
|
295
|
-
* @param
|
|
181
|
+
* @param {IPath2DLayerProps} [data] - The properties to validate.
|
|
296
182
|
* @returns {IPath2DLayerProps} The validated properties.
|
|
297
183
|
*/
|
|
298
184
|
validateProps(data) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
|
|
2
2
|
import { ColorType, ScaleType, Point, 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 Quadratic Layer.
|
|
7
7
|
*/
|
|
@@ -67,47 +67,47 @@ export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
|
|
|
67
67
|
props: IQuadraticLayerProps;
|
|
68
68
|
/**
|
|
69
69
|
* Constructs a new QuadraticLayer instance.
|
|
70
|
-
* @param
|
|
71
|
-
* @param
|
|
70
|
+
* @param {IQuadraticLayerProps} [props] - The properties of the Quadratic Layer.
|
|
71
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
72
72
|
*/
|
|
73
73
|
constructor(props?: IQuadraticLayerProps, misc?: IBaseLayerMisc);
|
|
74
74
|
/**
|
|
75
75
|
* Sets the control point of the quadratic layer.
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
76
|
+
* @param {ScaleType} [x] - The x-coordinate of the control point.
|
|
77
|
+
* @param {ScaleType} [y] - The y-coordinate of the control point.
|
|
78
78
|
* @returns {this} The current instance for chaining.
|
|
79
79
|
*/
|
|
80
80
|
setControlPoint(x: ScaleType, y: ScaleType): this;
|
|
81
81
|
/**
|
|
82
82
|
* Sets the end point of the quadratic layer.
|
|
83
|
-
* @param
|
|
84
|
-
* @param
|
|
83
|
+
* @param {ScaleType} [x] - The x-coordinate of the end point.
|
|
84
|
+
* @param {ScaleType} [y] - The y-coordinate of the end point.
|
|
85
85
|
* @returns {this} The current instance for chaining.
|
|
86
86
|
*/
|
|
87
87
|
setEndPosition(x: ScaleType, y: ScaleType): this;
|
|
88
88
|
/**
|
|
89
89
|
* Sets the color of the layer.
|
|
90
|
-
* @param
|
|
90
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
91
91
|
* @returns {this} The current instance for chaining.
|
|
92
92
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
93
93
|
*/
|
|
94
94
|
setColor(color: ColorType): this;
|
|
95
95
|
/**
|
|
96
96
|
* Sets the stroke properties of the layer.
|
|
97
|
-
* @param
|
|
98
|
-
* @param
|
|
99
|
-
* @param
|
|
100
|
-
* @param
|
|
101
|
-
* @param
|
|
102
|
-
* @param
|
|
97
|
+
* @param {number} [width] - The width of the stroke.
|
|
98
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
99
|
+
* @param {string} [join] - The join style of the stroke.
|
|
100
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
101
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
102
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
103
103
|
* @returns {this} The current instance for chaining.
|
|
104
104
|
*/
|
|
105
105
|
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
|
|
106
106
|
/**
|
|
107
107
|
* Calculates the bounding box of the quadratic curve.
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
108
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
109
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
110
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
111
111
|
* @returns {Object} The bounding box details including max, min, center, width, and height.
|
|
112
112
|
*/
|
|
113
113
|
getBoundingBox(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager): {
|
|
@@ -128,10 +128,10 @@ export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
|
|
|
128
128
|
};
|
|
129
129
|
/**
|
|
130
130
|
* Draws the quadratic curve on the canvas.
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @param
|
|
134
|
-
* @param
|
|
131
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
132
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
133
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
134
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
135
135
|
*/
|
|
136
136
|
draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
137
137
|
/**
|
|
@@ -141,7 +141,7 @@ export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
|
|
|
141
141
|
toJSON(): IQuadraticLayer;
|
|
142
142
|
/**
|
|
143
143
|
* Validates the properties of the Quadratic Layer.
|
|
144
|
-
* @param
|
|
144
|
+
* @param {IQuadraticLayerProps} [data] - The properties to validate.
|
|
145
145
|
* @returns {IQuadraticLayerProps} The validated properties.
|
|
146
146
|
*/
|
|
147
147
|
protected validateProps(data: IQuadraticLayerProps): IQuadraticLayerProps;
|
|
@@ -15,8 +15,8 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
15
15
|
props;
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a new QuadraticLayer instance.
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
18
|
+
* @param {IQuadraticLayerProps} [props] - The properties of the Quadratic Layer.
|
|
19
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
20
20
|
*/
|
|
21
21
|
constructor(props, misc) {
|
|
22
22
|
super(types_1.LayerType.QuadraticCurve, props || {}, misc);
|
|
@@ -25,8 +25,8 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Sets the control point of the quadratic layer.
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
28
|
+
* @param {ScaleType} [x] - The x-coordinate of the control point.
|
|
29
|
+
* @param {ScaleType} [y] - The y-coordinate of the control point.
|
|
30
30
|
* @returns {this} The current instance for chaining.
|
|
31
31
|
*/
|
|
32
32
|
setControlPoint(x, y) {
|
|
@@ -35,8 +35,8 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Sets the end point of the quadratic layer.
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
38
|
+
* @param {ScaleType} [x] - The x-coordinate of the end point.
|
|
39
|
+
* @param {ScaleType} [y] - The y-coordinate of the end point.
|
|
40
40
|
* @returns {this} The current instance for chaining.
|
|
41
41
|
*/
|
|
42
42
|
setEndPosition(x, y) {
|
|
@@ -45,7 +45,7 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Sets the color of the layer.
|
|
48
|
-
* @param
|
|
48
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
49
49
|
* @returns {this} The current instance for chaining.
|
|
50
50
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
51
51
|
*/
|
|
@@ -59,12 +59,12 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Sets the stroke properties of the layer.
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
62
|
+
* @param {number} [width] - The width of the stroke.
|
|
63
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
64
|
+
* @param {string} [join] - The join style of the stroke.
|
|
65
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
66
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
67
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
68
68
|
* @returns {this} The current instance for chaining.
|
|
69
69
|
*/
|
|
70
70
|
setStroke(width, cap, join, dash, dashOffset, miterLimit) {
|
|
@@ -80,9 +80,9 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Calculates the bounding box of the quadratic curve.
|
|
83
|
-
* @param
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
83
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
84
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
85
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
86
86
|
* @returns {Object} The bounding box details including max, min, center, width, and height.
|
|
87
87
|
*/
|
|
88
88
|
getBoundingBox(ctx, canvas, manager) {
|
|
@@ -100,10 +100,10 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Draws the quadratic curve on the canvas.
|
|
103
|
-
* @param
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
103
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
104
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
105
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
106
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
107
107
|
*/
|
|
108
108
|
async draw(ctx, canvas, manager, debug) {
|
|
109
109
|
const parcer = (0, utils_1.parser)(ctx, canvas, manager);
|
|
@@ -154,7 +154,7 @@ class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Validates the properties of the Quadratic Layer.
|
|
157
|
-
* @param
|
|
157
|
+
* @param {IQuadraticLayerProps} [data] - The properties to validate.
|
|
158
158
|
* @returns {IQuadraticLayerProps} The validated properties.
|
|
159
159
|
*/
|
|
160
160
|
validateProps(data) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
|
|
2
2
|
import { ScaleType, ColorType, AnyWeight, AnyTextAlign, AnyTextBaseline, AnyTextDirection, LineCap, LineJoin, 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 Text Layer.
|
|
7
7
|
*/
|
|
@@ -126,21 +126,21 @@ export declare class TextLayer extends BaseLayer<ITextLayerProps> {
|
|
|
126
126
|
props: ITextLayerProps;
|
|
127
127
|
/**
|
|
128
128
|
* Constructs a new TextLayer instance.
|
|
129
|
-
* @param
|
|
130
|
-
* @param
|
|
129
|
+
* @param {ITextLayerProps} [props] - The properties of the Text Layer.
|
|
130
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
131
131
|
*/
|
|
132
132
|
constructor(props?: ITextLayerProps, misc?: IBaseLayerMisc);
|
|
133
133
|
/**
|
|
134
134
|
* Sets the text of the text layer.
|
|
135
|
-
* @param
|
|
135
|
+
* @param {string} [text] - The text content of the layer.
|
|
136
136
|
* @returns {this} The current instance for chaining.
|
|
137
137
|
*/
|
|
138
138
|
setText(text: string): this;
|
|
139
139
|
/**
|
|
140
140
|
* Sets the font of the text layer.
|
|
141
|
-
* @param
|
|
142
|
-
* @param
|
|
143
|
-
* @param
|
|
141
|
+
* @param {string | { family: string; size: number; weight: AnyWeight }} [familyOrConfig] - The font family or configuration object.
|
|
142
|
+
* @param {number} [size] - The font size (required if `familyOrConfig` is a string).
|
|
143
|
+
* @param {AnyWeight} [weight] - The font weight (required if `familyOrConfig` is a string).
|
|
144
144
|
* @returns {this} The current instance for chaining.
|
|
145
145
|
* @throws {LazyError} If size or weight is not provided when `familyOrConfig` is a string.
|
|
146
146
|
*/
|
|
@@ -151,71 +151,65 @@ export declare class TextLayer extends BaseLayer<ITextLayerProps> {
|
|
|
151
151
|
}, size?: number, weight?: AnyWeight): this;
|
|
152
152
|
/**
|
|
153
153
|
* Configures the multiline properties of the text layer.
|
|
154
|
-
* @param
|
|
155
|
-
* @param
|
|
156
|
-
* @param
|
|
157
|
-
* @param
|
|
154
|
+
* @param {boolean} [enabled] - Whether multiline is enabled.
|
|
155
|
+
* @param {ScaleType} [width] - The width of the multiline text area.
|
|
156
|
+
* @param {ScaleType} [height] - The height of the multiline text area.
|
|
157
|
+
* @param {number} [spacing] - The spacing between lines (optional).
|
|
158
158
|
* @returns {this} The current instance for chaining.
|
|
159
159
|
*/
|
|
160
160
|
setMultiline(enabled: boolean, width: ScaleType, height: ScaleType, spacing?: number): this;
|
|
161
161
|
/**
|
|
162
162
|
* Sets the color of the text layer.
|
|
163
|
-
* @param
|
|
163
|
+
* @param {ColorType} [color] - The color of the text.
|
|
164
164
|
* @returns {this} The current instance for chaining.
|
|
165
165
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
166
166
|
*/
|
|
167
167
|
setColor(color: ColorType): this;
|
|
168
168
|
/**
|
|
169
169
|
* Sets the alignment of the text layer.
|
|
170
|
-
* @param
|
|
170
|
+
* @param {AnyTextAlign} [align] - The alignment of the text.
|
|
171
171
|
* @returns {this} The current instance for chaining.
|
|
172
172
|
*/
|
|
173
173
|
setAlign(align: AnyTextAlign): this;
|
|
174
174
|
/**
|
|
175
175
|
* Sets the baseline of the text layer.
|
|
176
|
-
* @param
|
|
176
|
+
* @param {AnyTextBaseline} [baseline] - The baseline of the text.
|
|
177
177
|
* @returns {this} The current instance for chaining.
|
|
178
178
|
*/
|
|
179
179
|
setBaseline(baseline: AnyTextBaseline): this;
|
|
180
180
|
/**
|
|
181
181
|
* Sets the direction of the text layer.
|
|
182
|
-
* @param
|
|
182
|
+
* @param {AnyTextDirection} [direction] - The direction of the text.
|
|
183
183
|
* @returns {this} The current instance for chaining.
|
|
184
184
|
*/
|
|
185
185
|
setDirection(direction: AnyTextDirection): this;
|
|
186
186
|
/**
|
|
187
187
|
* Configures the stroke properties of the text layer.
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
190
|
-
* @param
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
188
|
+
* @param {number} [width] - The width of the stroke.
|
|
189
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
190
|
+
* @param {string} [join] - The join style of the stroke.
|
|
191
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
192
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
193
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
194
194
|
* @returns {this} The current instance for chaining.
|
|
195
195
|
*/
|
|
196
196
|
setStroke(width: number, cap?: LineCap, join?: LineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
|
|
197
|
-
/**
|
|
198
|
-
* Sets whether the text layer should be filled or stroked.
|
|
199
|
-
* @param filled {boolean} - If true, the layer will be filled; otherwise, it will be stroked.
|
|
200
|
-
* @returns {this} The current instance for chaining.
|
|
201
|
-
*/
|
|
202
|
-
setFilled(filled: boolean): this;
|
|
203
197
|
/**
|
|
204
198
|
* Sets the spacing between words in the text layer.
|
|
205
|
-
* @param
|
|
199
|
+
* @param {number} [wordSpacing] - The spacing between words.
|
|
206
200
|
* @returns {this} The current instance for chaining.
|
|
207
201
|
*/
|
|
208
202
|
setWordSpacing(wordSpacing: number): this;
|
|
209
203
|
/**
|
|
210
204
|
* Sets the spacing between letters in the text layer.
|
|
211
|
-
* @param
|
|
205
|
+
* @param {number} [letterSpacing] - The spacing between letters.
|
|
212
206
|
* @returns {this} The current instance for chaining.
|
|
213
207
|
*/
|
|
214
208
|
setLetterSpacing(letterSpacing: number): this;
|
|
215
209
|
/**
|
|
216
210
|
* Measures the dimensions of the text.
|
|
217
|
-
* @param
|
|
218
|
-
* @param
|
|
211
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
212
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
219
213
|
* @returns {Object} The width and height of the text.
|
|
220
214
|
*/
|
|
221
215
|
measureText(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas): {
|
|
@@ -224,21 +218,21 @@ export declare class TextLayer extends BaseLayer<ITextLayerProps> {
|
|
|
224
218
|
};
|
|
225
219
|
/**
|
|
226
220
|
* Draws the text layer on the canvas.
|
|
227
|
-
* @param
|
|
228
|
-
* @param
|
|
229
|
-
* @param
|
|
230
|
-
* @param
|
|
221
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
222
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
223
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
224
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
231
225
|
*/
|
|
232
226
|
draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
233
227
|
/**
|
|
234
228
|
* Draws the text on the canvas.
|
|
235
|
-
* @param
|
|
236
|
-
* @param
|
|
237
|
-
* @param
|
|
238
|
-
* @param
|
|
239
|
-
* @param
|
|
240
|
-
* @param
|
|
241
|
-
* @param
|
|
229
|
+
* @param {ITextLayerProps} [props] - The properties of the text layer.
|
|
230
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
231
|
+
* @param {string | CanvasGradient | CanvasPattern} [fillStyle] - The fill style for the text.
|
|
232
|
+
* @param {string} [text] - The text content.
|
|
233
|
+
* @param {number} [x] - The x-coordinate of the text.
|
|
234
|
+
* @param {number} [y] - The y-coordinate of the text.
|
|
235
|
+
* @param {number} [w] - The width of the text area.
|
|
242
236
|
*/
|
|
243
237
|
private drawText;
|
|
244
238
|
/**
|
|
@@ -248,7 +242,7 @@ export declare class TextLayer extends BaseLayer<ITextLayerProps> {
|
|
|
248
242
|
toJSON(): ITextLayer;
|
|
249
243
|
/**
|
|
250
244
|
* Validates the properties of the Text Layer.
|
|
251
|
-
* @param
|
|
245
|
+
* @param {ITextLayerProps} [props] - The properties to validate.
|
|
252
246
|
* @returns {ITextLayerProps} The validated properties.
|
|
253
247
|
*/
|
|
254
248
|
protected validateProps(props: ITextLayerProps): ITextLayerProps;
|