apexify.js 5.1.0 → 5.1.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/CHANGELOG.md +23 -38
- package/README.md +5 -9
- package/lib/Canvas/utils/Custom/advancedLines.ts +387 -387
- package/lib/Canvas/utils/Custom/customLines.ts +206 -206
- package/lib/Canvas/utils/types.ts +983 -983
- package/package.json +198 -198
|
@@ -1,983 +1,983 @@
|
|
|
1
|
-
import { Canvas, SKRSContext2D } from "@napi-rs/canvas"
|
|
2
|
-
import { PathLike } from "fs";
|
|
3
|
-
/**
|
|
4
|
-
* Configuration option to decide the outputformate from ApexPainter
|
|
5
|
-
* @param {type} default - 'buffer', other formates: url, blob, base64, dataURL, arraybuffer.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface OutputFormat {
|
|
9
|
-
type?: 'buffer' | 'url' | 'blob' | 'base64' | 'dataURL' | 'arraybuffer';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type AlignMode =
|
|
13
|
-
| 'center' | 'top' | 'bottom' | 'left' | 'right'
|
|
14
|
-
| 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
15
|
-
|
|
16
|
-
export type FitMode = 'fill' | 'contain' | 'cover';
|
|
17
|
-
|
|
18
|
-
export interface StrokeOptions {
|
|
19
|
-
color?: string;
|
|
20
|
-
gradient?: gradient;
|
|
21
|
-
width?: number; // px
|
|
22
|
-
position?: number; // px (+out/-in)
|
|
23
|
-
blur?: number; // px
|
|
24
|
-
opacity?: number; // 0..1
|
|
25
|
-
borderRadius?: number | 'circular';
|
|
26
|
-
borderPosition?: borderPosition;
|
|
27
|
-
style?: 'solid' | 'dashed' | 'dotted' | 'groove' | 'ridge' | 'double';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ShadowOptions {
|
|
31
|
-
color?: string; // e.g. 'rgba(0,0,0,1)'
|
|
32
|
-
gradient?: gradient; // <— gradient-capable shadow
|
|
33
|
-
offsetX?: number; // px
|
|
34
|
-
offsetY?: number; // px
|
|
35
|
-
blur?: number; // px
|
|
36
|
-
opacity?: number; // 0..1
|
|
37
|
-
borderRadius?: number | "circular";
|
|
38
|
-
borderPosition?: borderPosition;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface BoxBackground {
|
|
42
|
-
color?: string;
|
|
43
|
-
gradient?: gradient;
|
|
44
|
-
}
|
|
45
|
-
export type GradientStop = { stop: number; color: string };
|
|
46
|
-
|
|
47
|
-
export type gradient =
|
|
48
|
-
| {
|
|
49
|
-
type: 'linear';
|
|
50
|
-
// line from (startX,startY) to (endX,endY)
|
|
51
|
-
startX?: number; startY?: number;
|
|
52
|
-
endX?: number; endY?: number;
|
|
53
|
-
rotate?: number; // degrees, rotation around pivot (default: canvas center)
|
|
54
|
-
pivotX?: number; pivotY?: number; // optional pivot for rotation
|
|
55
|
-
colors: GradientStop[];
|
|
56
|
-
}
|
|
57
|
-
| {
|
|
58
|
-
type: 'radial';
|
|
59
|
-
// two circles (default to center-based radial if not supplied)
|
|
60
|
-
startX?: number; startY?: number; startRadius?: number; // inner circle
|
|
61
|
-
endX?: number; endY?: number; endRadius?: number; // outer circle
|
|
62
|
-
// rotation is NOP for perfectly concentric radial, but supported if centers aren't equal
|
|
63
|
-
rotate?: number; pivotX?: number; pivotY?: number;
|
|
64
|
-
colors: GradientStop[];
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export type borderPosition = 'all' | 'top' | 'left' | 'right' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | string;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Configuration options for the canvas.
|
|
71
|
-
* @param {number} width - The width of the canvas.
|
|
72
|
-
* @param {number} height - The height of the canvas.
|
|
73
|
-
* @param {string} customBg - The URL or local path to the custom background image.
|
|
74
|
-
* @param {string} colorBg - The background color of the canvas.
|
|
75
|
-
* @param {object} gradientBg - The gradient settings for the canvas background.
|
|
76
|
-
* @param {number | string} borderRadius - The border radius of the canvas.
|
|
77
|
-
*/
|
|
78
|
-
export interface CanvasConfig {
|
|
79
|
-
width?: number;
|
|
80
|
-
height?: number;
|
|
81
|
-
x?: number;
|
|
82
|
-
y?: number;
|
|
83
|
-
|
|
84
|
-
customBg?: {
|
|
85
|
-
source: string
|
|
86
|
-
inherit?: boolean;
|
|
87
|
-
fit?: 'fill' | 'contain' | 'cover';
|
|
88
|
-
align?: 'center' | 'top' | 'bottom' | 'left' | 'right'
|
|
89
|
-
| 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
90
|
-
filters?: ImageFilter[]; // NEW: Apply filters to background image
|
|
91
|
-
opacity?: number; // NEW: Background image opacity
|
|
92
|
-
};
|
|
93
|
-
videoBg?: {
|
|
94
|
-
source: string | Buffer; // Video file path, URL, or Buffer
|
|
95
|
-
frame?: number; // Extract specific frame number (default: 0)
|
|
96
|
-
time?: number; // Extract frame at specific time in seconds (overrides frame if provided)
|
|
97
|
-
loop?: boolean; // Loop video (default: false)
|
|
98
|
-
autoplay?: boolean; // Autoplay (default: false)
|
|
99
|
-
opacity?: number; // Video opacity (default: 1)
|
|
100
|
-
format?: 'jpg' | 'png'; // Output format (default: 'jpg')
|
|
101
|
-
quality?: number; // JPEG quality 1-31, lower = better (default: 2)
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
colorBg?: string;
|
|
105
|
-
gradientBg?: gradient;
|
|
106
|
-
patternBg?: PatternOptions;
|
|
107
|
-
noiseBg?: { intensity?: number };
|
|
108
|
-
bgLayers?: Array<
|
|
109
|
-
{ type: "color"; value: string } |
|
|
110
|
-
{ type: "gradient"; value: gradient } |
|
|
111
|
-
{ type: "image"; source: string; opacity?: number } |
|
|
112
|
-
{ type: "pattern"; source: string; repeat?: string; opacity?: number } |
|
|
113
|
-
{ type: "noise"; intensity?: number }
|
|
114
|
-
>;
|
|
115
|
-
blendMode?: GlobalCompositeOperation;
|
|
116
|
-
|
|
117
|
-
opacity?: number;
|
|
118
|
-
blur?: number;
|
|
119
|
-
|
|
120
|
-
rotation?: number;
|
|
121
|
-
borderRadius?: number | "circular";
|
|
122
|
-
borderPosition?: borderPosition;
|
|
123
|
-
|
|
124
|
-
zoom?: {
|
|
125
|
-
scale?: number; // optional, defaults to 1
|
|
126
|
-
centerX?: number;
|
|
127
|
-
centerY?: number;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
stroke?: {
|
|
132
|
-
color?: string;
|
|
133
|
-
blur?: number;
|
|
134
|
-
width?: number;
|
|
135
|
-
position?: number;
|
|
136
|
-
borderRadius?: number | "circular";
|
|
137
|
-
borderPosition?: borderPosition;
|
|
138
|
-
gradient?: gradient;
|
|
139
|
-
style?: 'solid' | 'dashed' | 'dotted' | 'groove' | 'ridge' | 'double';
|
|
140
|
-
};
|
|
141
|
-
shadow?: {
|
|
142
|
-
color?: string;
|
|
143
|
-
offsetX?: number;
|
|
144
|
-
offsetY?: number;
|
|
145
|
-
blur?: number;
|
|
146
|
-
opacity?: number;
|
|
147
|
-
borderRadius?: number | "circular";
|
|
148
|
-
gradient?: gradient;
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Properties of an image or shape to be drawn on the canvas.
|
|
154
|
-
* @param {string} source - URL or path to the image or shape name.
|
|
155
|
-
* @param {number} width - The width of the image or shape.
|
|
156
|
-
* @param {number} height - The height of the image or shape.
|
|
157
|
-
* @param {number} x - The x-coordinate of the image or shape.
|
|
158
|
-
* @param {number} y - The y-coordinate of the image or shape.
|
|
159
|
-
* @param {boolean} isFilled - Whether the shape is filled or not (Only applicable if source is a shape name).
|
|
160
|
-
* @param {string} color - The color of the shape (Only applicable if source is a shape name).
|
|
161
|
-
* @param {object} gradient - The gradient settings for the shape (Only applicable if source is a shape name).
|
|
162
|
-
* @param {number} rotation - Rotation angle in degrees.
|
|
163
|
-
* @param {number | string} borderRadius - The border radius of the image or shape.
|
|
164
|
-
* @param {object} stroke - The stroke properties.
|
|
165
|
-
* @param {string} stroke.color - The color of the stroke.
|
|
166
|
-
* @param {number} stroke.width - The width of the stroke.
|
|
167
|
-
* @param {number} stroke.position - Space between stroke and the image it's stroked on.
|
|
168
|
-
* @param {number | string} stroke.borderRadius - The border radius of the stroke.
|
|
169
|
-
* @param {object} shadow - The shadow properties.
|
|
170
|
-
* @param {string} shadow.color - The color of the shadow.
|
|
171
|
-
* @param {number} shadow.offsetX - The horizontal offset of the shadow.
|
|
172
|
-
* @param {number} shadow.offsetY - The vertical offset of the shadow.
|
|
173
|
-
* @param {number} shadow.blur - The blur radius of the shadow.
|
|
174
|
-
* @param {number} shadow.opacity - The opacity of the shadow.
|
|
175
|
-
* @param {number | string} shadow.borderRadius - The border radius of the shadow.
|
|
176
|
-
*/
|
|
177
|
-
export type ShapeType = 'rectangle' | 'square' | 'circle' | 'triangle' | 'trapezium' | 'star' | 'heart' | 'polygon';
|
|
178
|
-
|
|
179
|
-
export interface ShapeProperties {
|
|
180
|
-
fill?: boolean;
|
|
181
|
-
color?: string;
|
|
182
|
-
gradient?: gradient;
|
|
183
|
-
points?: { x: number; y: number }[]; // for polygon
|
|
184
|
-
radius?: number; // for circle
|
|
185
|
-
sides?: number; // for polygon
|
|
186
|
-
innerRadius?: number; // for star
|
|
187
|
-
outerRadius?: number; // for star
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export interface ImageProperties {
|
|
191
|
-
// required
|
|
192
|
-
source: string | Buffer | ShapeType;
|
|
193
|
-
x: number;
|
|
194
|
-
y: number;
|
|
195
|
-
|
|
196
|
-
// size (if omitted and inherit=true -> use intrinsic)
|
|
197
|
-
width?: number;
|
|
198
|
-
height?: number;
|
|
199
|
-
inherit?: boolean;
|
|
200
|
-
|
|
201
|
-
// fitting
|
|
202
|
-
fit?: FitMode; // default 'fill'
|
|
203
|
-
align?: AlignMode; // default 'center'
|
|
204
|
-
|
|
205
|
-
// visuals
|
|
206
|
-
rotation?: number; // deg around box center
|
|
207
|
-
opacity?: number; // bitmap alpha
|
|
208
|
-
blur?: number; // bitmap blur px
|
|
209
|
-
borderRadius?: number | 'circular';
|
|
210
|
-
borderPosition?: string;
|
|
211
|
-
|
|
212
|
-
// image filters
|
|
213
|
-
filters?: ImageFilter[];
|
|
214
|
-
filterIntensity?: number; // Global filter intensity multiplier (default: 1)
|
|
215
|
-
filterOrder?: 'pre' | 'post'; // Apply before or after transformations (default: 'post')
|
|
216
|
-
|
|
217
|
-
// image masking
|
|
218
|
-
mask?: {
|
|
219
|
-
source: string | Buffer; // Mask image
|
|
220
|
-
mode?: 'alpha' | 'luminance' | 'inverse'; // Mask mode (default: 'alpha')
|
|
221
|
-
};
|
|
222
|
-
clipPath?: Array<{ x: number; y: number }>; // Custom clipping path polygon
|
|
223
|
-
|
|
224
|
-
// image distortion/transform
|
|
225
|
-
distortion?: {
|
|
226
|
-
type: 'perspective' | 'warp' | 'bulge' | 'pinch';
|
|
227
|
-
points?: Array<{ x: number; y: number }>; // Control points for perspective/warp
|
|
228
|
-
intensity?: number; // Intensity for bulge/pinch (default: 0.5)
|
|
229
|
-
};
|
|
230
|
-
meshWarp?: {
|
|
231
|
-
gridX?: number; // Grid divisions X (default: 10)
|
|
232
|
-
gridY?: number; // Grid divisions Y (default: 10)
|
|
233
|
-
controlPoints?: Array<Array<{ x: number; y: number }>>; // Control point grid
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// image effects stack
|
|
237
|
-
effects?: {
|
|
238
|
-
vignette?: { intensity: number; size: number }; // Vignette effect (0-1, 0-1)
|
|
239
|
-
lensFlare?: { x: number; y: number; intensity: number }; // Lens flare position and intensity
|
|
240
|
-
chromaticAberration?: { intensity: number }; // Chromatic aberration (0-1)
|
|
241
|
-
filmGrain?: { intensity: number }; // Film grain effect (0-1)
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
// shape properties (when source is a shape)
|
|
245
|
-
shape?: ShapeProperties;
|
|
246
|
-
|
|
247
|
-
// independent passes
|
|
248
|
-
shadow?: ShadowOptions;
|
|
249
|
-
stroke?: StrokeOptions;
|
|
250
|
-
boxBackground?: BoxBackground; // under bitmap, inside clip
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export interface ImageFilter {
|
|
254
|
-
type: 'gaussianBlur' | 'motionBlur' | 'radialBlur' | 'sharpen' | 'noise' | 'grain' |
|
|
255
|
-
'edgeDetection' | 'emboss' | 'invert' | 'grayscale' | 'sepia' | 'pixelate' |
|
|
256
|
-
'brightness' | 'contrast' | 'saturation' | 'hueShift' | 'posterize';
|
|
257
|
-
intensity?: number;
|
|
258
|
-
radius?: number;
|
|
259
|
-
angle?: number; // for motion blur
|
|
260
|
-
centerX?: number; // for radial blur
|
|
261
|
-
centerY?: number; // for radial blur
|
|
262
|
-
value?: number; // for brightness, contrast, saturation, hue shift
|
|
263
|
-
levels?: number; // for posterize
|
|
264
|
-
size?: number; // for pixelate
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Enhanced text properties interface with comprehensive styling options
|
|
271
|
-
*/
|
|
272
|
-
export interface TextProperties {
|
|
273
|
-
// === CORE TEXT PROPERTIES ===
|
|
274
|
-
/** Text content to render */
|
|
275
|
-
text: string;
|
|
276
|
-
/** X position on canvas */
|
|
277
|
-
x: number;
|
|
278
|
-
/** Y position on canvas */
|
|
279
|
-
y: number;
|
|
280
|
-
|
|
281
|
-
// === FONT MANAGEMENT ===
|
|
282
|
-
/** Font configuration object */
|
|
283
|
-
font?: {
|
|
284
|
-
/** Font size in pixels (default: 16) */
|
|
285
|
-
size?: number;
|
|
286
|
-
/** Font family name (e.g., 'Arial', 'Helvetica', 'Times New Roman') */
|
|
287
|
-
family?: string;
|
|
288
|
-
/** Custom font name (used with fontPath) */
|
|
289
|
-
name?: string;
|
|
290
|
-
/** Path to custom font file (.ttf, .otf, .woff, etc.) */
|
|
291
|
-
path?: string;
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
// === LEGACY FONT PROPERTIES (for backward compatibility) ===
|
|
295
|
-
/** @deprecated Use font.size instead */
|
|
296
|
-
fontSize?: number;
|
|
297
|
-
/** @deprecated Use font.family instead */
|
|
298
|
-
fontFamily?: string;
|
|
299
|
-
/** @deprecated Use font.name instead */
|
|
300
|
-
fontName?: string;
|
|
301
|
-
/** @deprecated Use font.path instead */
|
|
302
|
-
fontPath?: string;
|
|
303
|
-
|
|
304
|
-
// === TEXT DECORATION ===
|
|
305
|
-
/** Make text bold */
|
|
306
|
-
bold?: boolean;
|
|
307
|
-
/** Make text italic */
|
|
308
|
-
italic?: boolean;
|
|
309
|
-
/** Add underline decoration */
|
|
310
|
-
underline?: boolean | {
|
|
311
|
-
/** Underline color */
|
|
312
|
-
color?: string;
|
|
313
|
-
/** Underline gradient (overrides color) */
|
|
314
|
-
gradient?: gradient;
|
|
315
|
-
/** Underline width (default: 1px) */
|
|
316
|
-
width?: number;
|
|
317
|
-
};
|
|
318
|
-
/** Add overline decoration */
|
|
319
|
-
overline?: boolean | {
|
|
320
|
-
/** Overline color */
|
|
321
|
-
color?: string;
|
|
322
|
-
/** Overline gradient (overrides color) */
|
|
323
|
-
gradient?: gradient;
|
|
324
|
-
/** Overline width (default: 1px) */
|
|
325
|
-
width?: number;
|
|
326
|
-
};
|
|
327
|
-
/** Add strikethrough decoration */
|
|
328
|
-
strikethrough?: boolean | {
|
|
329
|
-
/** Strikethrough color */
|
|
330
|
-
color?: string;
|
|
331
|
-
/** Strikethrough gradient (overrides color) */
|
|
332
|
-
gradient?: gradient;
|
|
333
|
-
/** Strikethrough width (default: 1px) */
|
|
334
|
-
width?: number;
|
|
335
|
-
};
|
|
336
|
-
/** Highlight text with background color */
|
|
337
|
-
highlight?: {
|
|
338
|
-
/** Highlight color (hex, rgb, rgba, hsl, etc.) */
|
|
339
|
-
color?: string;
|
|
340
|
-
/** Highlight gradient (overrides color) */
|
|
341
|
-
gradient?: gradient;
|
|
342
|
-
/** Highlight opacity (0-1, default: 0.3) */
|
|
343
|
-
opacity?: number;
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
// === SPACING & POSITIONING ===
|
|
347
|
-
/** Line height multiplier (default: 1.4) */
|
|
348
|
-
lineHeight?: number;
|
|
349
|
-
/** Space between letters in pixels */
|
|
350
|
-
letterSpacing?: number;
|
|
351
|
-
/** Space between words in pixels */
|
|
352
|
-
wordSpacing?: number;
|
|
353
|
-
/** Maximum width for text wrapping */
|
|
354
|
-
maxWidth?: number;
|
|
355
|
-
/** Maximum height for text (truncates with ellipsis) */
|
|
356
|
-
maxHeight?: number;
|
|
357
|
-
|
|
358
|
-
// === TEXT ALIGNMENT ===
|
|
359
|
-
/** Horizontal text alignment */
|
|
360
|
-
textAlign?: 'left' | 'center' | 'right' | 'start' | 'end';
|
|
361
|
-
/** Vertical text baseline */
|
|
362
|
-
textBaseline?: 'alphabetic' | 'bottom' | 'hanging' | 'ideographic' | 'middle' | 'top';
|
|
363
|
-
|
|
364
|
-
// === TEXT COLORING ===
|
|
365
|
-
/** Text color (hex, rgb, rgba, hsl, etc.) */
|
|
366
|
-
color?: string;
|
|
367
|
-
/** Gradient fill for text */
|
|
368
|
-
gradient?: gradient;
|
|
369
|
-
/** Text opacity (0-1, default: 1) */
|
|
370
|
-
opacity?: number;
|
|
371
|
-
|
|
372
|
-
// === TEXT EFFECTS ===
|
|
373
|
-
/** Text glow effect */
|
|
374
|
-
glow?: {
|
|
375
|
-
/** Glow color */
|
|
376
|
-
color?: string;
|
|
377
|
-
/** Glow gradient (overrides color) */
|
|
378
|
-
gradient?: gradient;
|
|
379
|
-
/** Glow intensity/blur radius */
|
|
380
|
-
intensity?: number;
|
|
381
|
-
/** Glow opacity (0-1) */
|
|
382
|
-
opacity?: number;
|
|
383
|
-
};
|
|
384
|
-
/** Text shadow effect */
|
|
385
|
-
shadow?: {
|
|
386
|
-
/** Shadow color */
|
|
387
|
-
color?: string;
|
|
388
|
-
/** Horizontal shadow offset */
|
|
389
|
-
offsetX?: number;
|
|
390
|
-
/** Vertical shadow offset */
|
|
391
|
-
offsetY?: number;
|
|
392
|
-
/** Shadow blur radius */
|
|
393
|
-
blur?: number;
|
|
394
|
-
/** Shadow opacity (0-1) */
|
|
395
|
-
opacity?: number;
|
|
396
|
-
};
|
|
397
|
-
/** Text stroke/outline */
|
|
398
|
-
stroke?: {
|
|
399
|
-
/** Stroke color */
|
|
400
|
-
color?: string;
|
|
401
|
-
/** Stroke width in pixels */
|
|
402
|
-
width?: number;
|
|
403
|
-
/** Gradient stroke */
|
|
404
|
-
gradient?: gradient;
|
|
405
|
-
/** Stroke opacity (0-1) */
|
|
406
|
-
opacity?: number;
|
|
407
|
-
/** Stroke style */
|
|
408
|
-
style?: 'solid' | 'dashed' | 'dotted' | 'groove' | 'ridge' | 'double';
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
// === TRANSFORMATIONS ===
|
|
412
|
-
/** Text rotation in degrees */
|
|
413
|
-
rotation?: number;
|
|
414
|
-
|
|
415
|
-
// === TEXT PATH/CURVE FOLLOWING ===
|
|
416
|
-
/** Path for text to follow */
|
|
417
|
-
path?: {
|
|
418
|
-
type: 'line' | 'arc' | 'bezier' | 'quadratic';
|
|
419
|
-
points: Array<{ x: number; y: number }>;
|
|
420
|
-
offset?: number; // Distance from path (default: 0)
|
|
421
|
-
};
|
|
422
|
-
/** Render text along path */
|
|
423
|
-
textOnPath?: boolean;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Legacy TextObject interface for backward compatibility
|
|
428
|
-
* @deprecated Use TextProperties instead
|
|
429
|
-
*/
|
|
430
|
-
export interface TextObject extends TextProperties {
|
|
431
|
-
/** @deprecated Use bold instead */
|
|
432
|
-
isBold?: boolean;
|
|
433
|
-
/** @deprecated Use outlined instead of stroke */
|
|
434
|
-
outlined?: boolean;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Options for creating a GIF.
|
|
439
|
-
* @param outputFormat The format of the output ('file', 'base64', 'attachment', or 'buffer').
|
|
440
|
-
* @param outputFile The file path if output format is 'file'.
|
|
441
|
-
* @param width The width of the GIF.
|
|
442
|
-
* @param height The height of the GIF.
|
|
443
|
-
* @param repeat The number of times the GIF should repeat.
|
|
444
|
-
* @param quality The quality of the GIF.
|
|
445
|
-
* @param delay The delay between frames in milliseconds.
|
|
446
|
-
* @param watermark The watermark settings.
|
|
447
|
-
* @param textOverlay The text overlay settings.
|
|
448
|
-
* @param basDir The base directory for files.
|
|
449
|
-
*/
|
|
450
|
-
export interface GIFOptions {
|
|
451
|
-
outputFormat: 'file' | 'base64' | 'attachment' | 'buffer' | string;
|
|
452
|
-
outputFile?: string;
|
|
453
|
-
width?: number;
|
|
454
|
-
height?: number;
|
|
455
|
-
repeat?: number;
|
|
456
|
-
quality?: number;
|
|
457
|
-
delay?: number;
|
|
458
|
-
watermark?: {
|
|
459
|
-
enable: boolean;
|
|
460
|
-
url: string;
|
|
461
|
-
};
|
|
462
|
-
textOverlay?: {
|
|
463
|
-
text: string;
|
|
464
|
-
fontName?: string;
|
|
465
|
-
fontPath?: string;
|
|
466
|
-
fontSize?: number;
|
|
467
|
-
fontColor?: string;
|
|
468
|
-
x?: number;
|
|
469
|
-
y?: number;
|
|
470
|
-
};
|
|
471
|
-
basDir?: any;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* Results of creating a GIF.
|
|
476
|
-
* @param buffer The buffer containing the GIF data.
|
|
477
|
-
* @param base64 The base64 representation of the GIF.
|
|
478
|
-
* @param attachment The attachment containing the GIF stream.
|
|
479
|
-
*/
|
|
480
|
-
export interface GIFResults {
|
|
481
|
-
buffer?: Buffer;
|
|
482
|
-
base64?: string;
|
|
483
|
-
attachment?: { attachment: NodeJS.ReadableStream | any; name: string };
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Custom options for drawing.
|
|
488
|
-
* @param startCoordinates The starting coordinates.
|
|
489
|
-
* @param endCoordinates The ending coordinates.
|
|
490
|
-
* @param lineStyle The style of the line.
|
|
491
|
-
*/
|
|
492
|
-
export interface CustomOptions {
|
|
493
|
-
startCoordinates: {
|
|
494
|
-
x: number;
|
|
495
|
-
y: number;
|
|
496
|
-
};
|
|
497
|
-
endCoordinates: {
|
|
498
|
-
x: number;
|
|
499
|
-
y: number;
|
|
500
|
-
};
|
|
501
|
-
// Advanced path options
|
|
502
|
-
path?: {
|
|
503
|
-
type: 'smooth' | 'bezier' | 'catmull-rom';
|
|
504
|
-
tension?: number; // For smooth/catmull-rom (default: 0.5)
|
|
505
|
-
closed?: boolean; // Close the path (default: false)
|
|
506
|
-
};
|
|
507
|
-
// Arrow markers
|
|
508
|
-
arrow?: {
|
|
509
|
-
start?: boolean; // Arrow at start (default: false)
|
|
510
|
-
end?: boolean; // Arrow at end (default: false)
|
|
511
|
-
size?: number; // Arrow size (default: 10)
|
|
512
|
-
style?: 'filled' | 'outline'; // Arrow style (default: 'filled')
|
|
513
|
-
color?: string; // Arrow color (default: line color)
|
|
514
|
-
};
|
|
515
|
-
// Path markers
|
|
516
|
-
markers?: Array<{
|
|
517
|
-
position: number; // 0-1 along path
|
|
518
|
-
shape: 'circle' | 'square' | 'diamond' | 'arrow';
|
|
519
|
-
size: number;
|
|
520
|
-
color: string;
|
|
521
|
-
}>;
|
|
522
|
-
lineStyle?: {
|
|
523
|
-
width?: number;
|
|
524
|
-
color?: string;
|
|
525
|
-
gradient?: gradient;
|
|
526
|
-
lineRadius?: number | string;
|
|
527
|
-
lineJoin?: 'round' | 'bevel' | 'miter';
|
|
528
|
-
lineCap?: 'butt' | 'round' | 'square';
|
|
529
|
-
singleLine?: boolean;
|
|
530
|
-
lineDash?: {
|
|
531
|
-
dashArray?: number[];
|
|
532
|
-
offset?: number;
|
|
533
|
-
};
|
|
534
|
-
// Line patterns
|
|
535
|
-
pattern?: {
|
|
536
|
-
type: 'dots' | 'dashes' | 'custom';
|
|
537
|
-
segments?: number[]; // For custom pattern
|
|
538
|
-
offset?: number; // Pattern offset
|
|
539
|
-
};
|
|
540
|
-
texture?: string | Buffer; // Texture image for line
|
|
541
|
-
stroke?: {
|
|
542
|
-
color?: string;
|
|
543
|
-
gradient?: gradient;
|
|
544
|
-
width?: number;
|
|
545
|
-
lineRadius?: number | string;
|
|
546
|
-
lineCap?: 'butt' | 'round' | 'square';
|
|
547
|
-
};
|
|
548
|
-
shadow?: {
|
|
549
|
-
offsetX?: number;
|
|
550
|
-
offsetY?: number;
|
|
551
|
-
blur?: number;
|
|
552
|
-
color?: string;
|
|
553
|
-
gradient?: gradient;
|
|
554
|
-
lineRadius?: number | string;
|
|
555
|
-
};
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
export interface ChartData {
|
|
560
|
-
height?: number;
|
|
561
|
-
width?: number;
|
|
562
|
-
widthPerc?: number;
|
|
563
|
-
heightPerc?: number;
|
|
564
|
-
title?: {
|
|
565
|
-
title?: string;
|
|
566
|
-
color?: string;
|
|
567
|
-
size?: number;
|
|
568
|
-
};
|
|
569
|
-
bg?: {
|
|
570
|
-
image?: string;
|
|
571
|
-
bgColor?: string;
|
|
572
|
-
};
|
|
573
|
-
grid?: {
|
|
574
|
-
enable: boolean;
|
|
575
|
-
color?: string;
|
|
576
|
-
width?: number;
|
|
577
|
-
};
|
|
578
|
-
axis?: {
|
|
579
|
-
color?: string;
|
|
580
|
-
size?: number;
|
|
581
|
-
};
|
|
582
|
-
labels?: {
|
|
583
|
-
color?: string;
|
|
584
|
-
fontSize?: number;
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
export interface DataPoint {
|
|
589
|
-
label: string;
|
|
590
|
-
barColor?: string;
|
|
591
|
-
stroke?: {
|
|
592
|
-
color?: string;
|
|
593
|
-
width?: number;
|
|
594
|
-
}
|
|
595
|
-
value: number;
|
|
596
|
-
position: {
|
|
597
|
-
startsXLabel: number;
|
|
598
|
-
endsXLabel: number;
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
export interface barChart_1 {
|
|
603
|
-
chartData?: ChartData;
|
|
604
|
-
xLabels: number[];
|
|
605
|
-
yLabels: number[];
|
|
606
|
-
data: {
|
|
607
|
-
xAxis: DataPoint[];
|
|
608
|
-
yAxis: number[];
|
|
609
|
-
keys?: { [color: string]: string };
|
|
610
|
-
keyColor?: string;
|
|
611
|
-
xTitle?: string;
|
|
612
|
-
yTitle?: string;
|
|
613
|
-
labelStyle?: {
|
|
614
|
-
color?: string;
|
|
615
|
-
size?: number;
|
|
616
|
-
};
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
export interface bgConfig {
|
|
622
|
-
width?: number;
|
|
623
|
-
height?: number;
|
|
624
|
-
bgcolor?: string;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
export interface KeyBoxConfig {
|
|
628
|
-
width?: number;
|
|
629
|
-
height?: number;
|
|
630
|
-
radius?: number;
|
|
631
|
-
bgcolor?: string;
|
|
632
|
-
x?: number;
|
|
633
|
-
y?: number;
|
|
634
|
-
content?: KeyBoxContent;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
export interface KeyBoxContent {
|
|
638
|
-
keyTitle?: {
|
|
639
|
-
text?: string;
|
|
640
|
-
fontSize?: number;
|
|
641
|
-
x?: number;
|
|
642
|
-
y?: number;
|
|
643
|
-
};
|
|
644
|
-
keys?: {
|
|
645
|
-
x?: number;
|
|
646
|
-
y?: number;
|
|
647
|
-
fontSize?: number;
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
export interface StrokeConfig {
|
|
652
|
-
color?: string;
|
|
653
|
-
size?: number;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
export interface TitleConfig {
|
|
657
|
-
text?: string;
|
|
658
|
-
color?: string;
|
|
659
|
-
fontSize?: number;
|
|
660
|
-
x?: number;
|
|
661
|
-
y?: number;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
export interface PieDataConfig {
|
|
665
|
-
x?: number;
|
|
666
|
-
y?: number;
|
|
667
|
-
stroke?: StrokeConfig;
|
|
668
|
-
title?: TitleConfig;
|
|
669
|
-
boxes?: {
|
|
670
|
-
labelDistance?: number;
|
|
671
|
-
width?: number;
|
|
672
|
-
height?: number;
|
|
673
|
-
fontSize?: number;
|
|
674
|
-
labelColor?: string;
|
|
675
|
-
boxColor?: string;
|
|
676
|
-
strokeColor?: string;
|
|
677
|
-
|
|
678
|
-
};
|
|
679
|
-
radius?: number;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
export interface PieConfig {
|
|
683
|
-
canvas?: bgConfig;
|
|
684
|
-
keyBox?: KeyBoxConfig;
|
|
685
|
-
pieData?: PieDataConfig;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
export interface DataItem {
|
|
689
|
-
label: string;
|
|
690
|
-
color: string;
|
|
691
|
-
value: number;
|
|
692
|
-
key: string;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
export interface PieChartData {
|
|
696
|
-
data?: DataItem[];
|
|
697
|
-
pieConfig?: PieConfig;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
export interface DataPoint {
|
|
702
|
-
label: string;
|
|
703
|
-
y: number;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
export interface LineChartConfig {
|
|
707
|
-
yLabels: string[];
|
|
708
|
-
fillArea: { color: string }[];
|
|
709
|
-
lineColor: string[];
|
|
710
|
-
plot?: {
|
|
711
|
-
enable: boolean;
|
|
712
|
-
color: string[];
|
|
713
|
-
size: number;
|
|
714
|
-
};
|
|
715
|
-
yaxisLabel?: {
|
|
716
|
-
label?: string;
|
|
717
|
-
x?: number;
|
|
718
|
-
y?: number;
|
|
719
|
-
color?: string;
|
|
720
|
-
fontSize?: string;
|
|
721
|
-
};
|
|
722
|
-
lineTension?: number[];
|
|
723
|
-
grid?: {
|
|
724
|
-
type: 'vertical' | 'horizontal' | 'both';
|
|
725
|
-
color: string;
|
|
726
|
-
width: number;
|
|
727
|
-
};
|
|
728
|
-
keys?: { [color: string]: string };
|
|
729
|
-
keysConfig?: {
|
|
730
|
-
radius?: number;
|
|
731
|
-
keyPadding?: number;
|
|
732
|
-
textPadding?: number;
|
|
733
|
-
lineWidth?: number;
|
|
734
|
-
fontColor?: string;
|
|
735
|
-
}
|
|
736
|
-
canvas?: {
|
|
737
|
-
bgColor?: string;
|
|
738
|
-
fontColor?: string;
|
|
739
|
-
fontSize?: number;
|
|
740
|
-
width?: number;
|
|
741
|
-
height?: number;
|
|
742
|
-
image?: string;
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
export interface cropCoordinate {
|
|
749
|
-
from: { x: number; y: number };
|
|
750
|
-
to: { x: number; y: number };
|
|
751
|
-
tension?: number;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
export interface cropOptions {
|
|
755
|
-
coordinates: cropCoordinate[];
|
|
756
|
-
imageSource: string;
|
|
757
|
-
crop: 'inner' | 'outer';
|
|
758
|
-
radius: number | "circular"
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
export interface GradientConfig{
|
|
763
|
-
type: 'linear' | 'radial';
|
|
764
|
-
startX?: number;
|
|
765
|
-
startY?: number;
|
|
766
|
-
endX?: number;
|
|
767
|
-
endY?: number;
|
|
768
|
-
startRadius?: number;
|
|
769
|
-
endRadius?: number;
|
|
770
|
-
angle?: number;
|
|
771
|
-
colors: {
|
|
772
|
-
stop: number;
|
|
773
|
-
color: string;
|
|
774
|
-
}[];
|
|
775
|
-
};
|
|
776
|
-
|
|
777
|
-
export interface Frame{
|
|
778
|
-
backgroundColor?: string;
|
|
779
|
-
gradient?: GradientConfig;
|
|
780
|
-
pattern?: {
|
|
781
|
-
source: string;
|
|
782
|
-
repeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
|
|
783
|
-
};
|
|
784
|
-
source?: string;
|
|
785
|
-
blendMode?: GlobalCompositeOperation;
|
|
786
|
-
transformations?: {
|
|
787
|
-
scaleX?: number;
|
|
788
|
-
scaleY?: number;
|
|
789
|
-
rotate?: number;
|
|
790
|
-
translateX?: number;
|
|
791
|
-
translateY?: number;
|
|
792
|
-
};
|
|
793
|
-
duration?: number;
|
|
794
|
-
width?: number;
|
|
795
|
-
height?: number;
|
|
796
|
-
onDrawCustom?: (ctx: SKRSContext2D, canvas: Canvas) => void;
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
/**
|
|
801
|
-
* Enhanced pattern options supporting all pattern types
|
|
802
|
-
*/
|
|
803
|
-
export interface PatternOptions {
|
|
804
|
-
// === PATTERN TYPE ===
|
|
805
|
-
/** Pattern type: built-in patterns or custom image */
|
|
806
|
-
type: 'grid' | 'dots' | 'diagonal' | 'stripes' | 'waves' | 'crosses' |
|
|
807
|
-
'hexagons' | 'checkerboard' | 'diamonds' | 'triangles' | 'stars' | 'polka' | 'custom';
|
|
808
|
-
|
|
809
|
-
// === PATTERN COLORS ===
|
|
810
|
-
/** Primary pattern color (default: '#ffffff') */
|
|
811
|
-
color?: string;
|
|
812
|
-
/** Secondary pattern color for two-color patterns (default: 'transparent') */
|
|
813
|
-
secondaryColor?: string;
|
|
814
|
-
/** Pattern opacity (0-1, default: 0.3) */
|
|
815
|
-
opacity?: number;
|
|
816
|
-
|
|
817
|
-
// === PATTERN SIZING ===
|
|
818
|
-
/** Pattern element size in pixels (default: 20) */
|
|
819
|
-
size?: number;
|
|
820
|
-
/** Spacing between pattern elements in pixels (default: 10) */
|
|
821
|
-
spacing?: number;
|
|
822
|
-
/** Pattern rotation angle in degrees (default: 0) */
|
|
823
|
-
rotation?: number;
|
|
824
|
-
|
|
825
|
-
// === CUSTOM PATTERN ===
|
|
826
|
-
/** Custom pattern image path/URL (for type: 'custom') */
|
|
827
|
-
customPatternImage?: string;
|
|
828
|
-
/** Custom pattern repeat mode (default: 'repeat') */
|
|
829
|
-
repeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
|
|
830
|
-
/** Custom pattern scale multiplier (default: 1) */
|
|
831
|
-
scale?: number;
|
|
832
|
-
|
|
833
|
-
// === PATTERN POSITIONING ===
|
|
834
|
-
/** Pattern offset X position (default: 0) */
|
|
835
|
-
offsetX?: number;
|
|
836
|
-
/** Pattern offset Y position (default: 0) */
|
|
837
|
-
offsetY?: number;
|
|
838
|
-
|
|
839
|
-
// === ADVANCED OPTIONS ===
|
|
840
|
-
/** Pattern blend mode (default: 'overlay') */
|
|
841
|
-
blendMode?: GlobalCompositeOperation;
|
|
842
|
-
/** Pattern gradient (overrides color) */
|
|
843
|
-
gradient?: GradientConfig;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
// Batch operation types
|
|
848
|
-
export interface BatchOperation {
|
|
849
|
-
type: 'canvas' | 'image' | 'text' | 'chart';
|
|
850
|
-
config: any;
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
export interface ChainOperation {
|
|
854
|
-
method: string;
|
|
855
|
-
args: any[];
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
// Image stitching options
|
|
859
|
-
export interface StitchOptions {
|
|
860
|
-
direction?: 'horizontal' | 'vertical' | 'grid';
|
|
861
|
-
overlap?: number; // Percentage overlap for auto-alignment (0-100)
|
|
862
|
-
blend?: boolean; // Blend overlapping areas (default: false)
|
|
863
|
-
spacing?: number; // Spacing between images in pixels (default: 0)
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
// Collage layout options
|
|
867
|
-
export interface CollageLayout {
|
|
868
|
-
type: 'grid' | 'masonry' | 'carousel' | 'custom';
|
|
869
|
-
columns?: number;
|
|
870
|
-
rows?: number;
|
|
871
|
-
spacing?: number;
|
|
872
|
-
background?: string;
|
|
873
|
-
borderRadius?: number;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
// Image compression options
|
|
877
|
-
export interface CompressionOptions {
|
|
878
|
-
quality?: number; // 0-100 (default: 90)
|
|
879
|
-
format?: 'jpeg' | 'webp' | 'avif';
|
|
880
|
-
maxWidth?: number;
|
|
881
|
-
maxHeight?: number;
|
|
882
|
-
progressive?: boolean; // For JPEG (default: false)
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
// Color palette extraction options
|
|
886
|
-
export interface PaletteOptions {
|
|
887
|
-
count?: number; // Number of colors (default: 10)
|
|
888
|
-
method?: 'kmeans' | 'median-cut' | 'octree';
|
|
889
|
-
format?: 'hex' | 'rgb' | 'hsl';
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
export interface ExtractFramesOptions {
|
|
893
|
-
outputDirectory?: string; // Directory to save frames
|
|
894
|
-
interval: number;
|
|
895
|
-
outputFormat?: 'jpg' | 'png';
|
|
896
|
-
frameSelection?: {
|
|
897
|
-
start?: number;
|
|
898
|
-
end?: number;
|
|
899
|
-
};
|
|
900
|
-
watermark?: string;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Options for resizing an image.
|
|
905
|
-
*/
|
|
906
|
-
export interface ResizeOptions {
|
|
907
|
-
imagePath: string;
|
|
908
|
-
size?: {
|
|
909
|
-
width?: number;
|
|
910
|
-
height?: number;
|
|
911
|
-
};
|
|
912
|
-
maintainAspectRatio?: boolean;
|
|
913
|
-
quality?: number;
|
|
914
|
-
outputFormat?: 'png' | 'jpeg';
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
export interface Point {
|
|
918
|
-
x: number;
|
|
919
|
-
y: number;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
export interface Coordinate {
|
|
923
|
-
from: Point;
|
|
924
|
-
to: Point;
|
|
925
|
-
tension?: number;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
export interface CropOptions {
|
|
929
|
-
imageSource: string;
|
|
930
|
-
coordinates: Coordinate[];
|
|
931
|
-
crop: 'inner' | 'outer';
|
|
932
|
-
radius?: number | "circular" | null;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
export interface MaskOptions {
|
|
936
|
-
type?: "alpha" | "grayscale" | "color";
|
|
937
|
-
threshold?: number;
|
|
938
|
-
invert?: boolean;
|
|
939
|
-
colorKey?: string;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
export interface BlendOptions {
|
|
943
|
-
type?: "linear" | "radial" | "conic";
|
|
944
|
-
angle?: number;
|
|
945
|
-
colors: { stop: number; color: string }[];
|
|
946
|
-
blendMode?: "multiply" | "overlay" | "screen" | "darken" | "lighten" | "difference";
|
|
947
|
-
maskSource?: string | Buffer | PathLike | Uint8Array;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
// Advanced Save Options
|
|
951
|
-
export interface SaveOptions {
|
|
952
|
-
/** Output directory path (default: './output') */
|
|
953
|
-
directory?: string;
|
|
954
|
-
/** File name or name pattern (default: auto-generated timestamp) */
|
|
955
|
-
filename?: string;
|
|
956
|
-
/** File format/extension (default: 'png') */
|
|
957
|
-
format?: 'png' | 'jpg' | 'jpeg' | 'webp' | 'avif' | 'gif';
|
|
958
|
-
/** Quality for JPEG/WebP (0-100, default: 90) */
|
|
959
|
-
quality?: number;
|
|
960
|
-
/** Auto-create directory if it doesn't exist (default: true) */
|
|
961
|
-
createDirectory?: boolean;
|
|
962
|
-
/** Naming pattern: 'timestamp' | 'counter' | 'custom' (default: 'timestamp') */
|
|
963
|
-
naming?: 'timestamp' | 'counter' | 'custom';
|
|
964
|
-
/** Counter starting value (for 'counter' naming, default: 1) */
|
|
965
|
-
counterStart?: number;
|
|
966
|
-
/** Prefix for filename (default: '') */
|
|
967
|
-
prefix?: string;
|
|
968
|
-
/** Suffix for filename (default: '') */
|
|
969
|
-
suffix?: string;
|
|
970
|
-
/** Overwrite existing files (default: false) */
|
|
971
|
-
overwrite?: boolean;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
export interface SaveResult {
|
|
975
|
-
/** Full path to saved file */
|
|
976
|
-
path: string;
|
|
977
|
-
/** File name */
|
|
978
|
-
filename: string;
|
|
979
|
-
/** File size in bytes */
|
|
980
|
-
size: number;
|
|
981
|
-
/** File format */
|
|
982
|
-
format: string;
|
|
983
|
-
}
|
|
1
|
+
import { Canvas, SKRSContext2D } from "@napi-rs/canvas"
|
|
2
|
+
import { PathLike } from "fs";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration option to decide the outputformate from ApexPainter
|
|
5
|
+
* @param {type} default - 'buffer', other formates: url, blob, base64, dataURL, arraybuffer.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface OutputFormat {
|
|
9
|
+
type?: 'buffer' | 'url' | 'blob' | 'base64' | 'dataURL' | 'arraybuffer';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type AlignMode =
|
|
13
|
+
| 'center' | 'top' | 'bottom' | 'left' | 'right'
|
|
14
|
+
| 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
15
|
+
|
|
16
|
+
export type FitMode = 'fill' | 'contain' | 'cover';
|
|
17
|
+
|
|
18
|
+
export interface StrokeOptions {
|
|
19
|
+
color?: string;
|
|
20
|
+
gradient?: gradient;
|
|
21
|
+
width?: number; // px
|
|
22
|
+
position?: number; // px (+out/-in)
|
|
23
|
+
blur?: number; // px
|
|
24
|
+
opacity?: number; // 0..1
|
|
25
|
+
borderRadius?: number | 'circular';
|
|
26
|
+
borderPosition?: borderPosition;
|
|
27
|
+
style?: 'solid' | 'dashed' | 'dotted' | 'groove' | 'ridge' | 'double';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ShadowOptions {
|
|
31
|
+
color?: string; // e.g. 'rgba(0,0,0,1)'
|
|
32
|
+
gradient?: gradient; // <— gradient-capable shadow
|
|
33
|
+
offsetX?: number; // px
|
|
34
|
+
offsetY?: number; // px
|
|
35
|
+
blur?: number; // px
|
|
36
|
+
opacity?: number; // 0..1
|
|
37
|
+
borderRadius?: number | "circular";
|
|
38
|
+
borderPosition?: borderPosition;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface BoxBackground {
|
|
42
|
+
color?: string;
|
|
43
|
+
gradient?: gradient;
|
|
44
|
+
}
|
|
45
|
+
export type GradientStop = { stop: number; color: string };
|
|
46
|
+
|
|
47
|
+
export type gradient =
|
|
48
|
+
| {
|
|
49
|
+
type: 'linear';
|
|
50
|
+
// line from (startX,startY) to (endX,endY)
|
|
51
|
+
startX?: number; startY?: number;
|
|
52
|
+
endX?: number; endY?: number;
|
|
53
|
+
rotate?: number; // degrees, rotation around pivot (default: canvas center)
|
|
54
|
+
pivotX?: number; pivotY?: number; // optional pivot for rotation
|
|
55
|
+
colors: GradientStop[];
|
|
56
|
+
}
|
|
57
|
+
| {
|
|
58
|
+
type: 'radial';
|
|
59
|
+
// two circles (default to center-based radial if not supplied)
|
|
60
|
+
startX?: number; startY?: number; startRadius?: number; // inner circle
|
|
61
|
+
endX?: number; endY?: number; endRadius?: number; // outer circle
|
|
62
|
+
// rotation is NOP for perfectly concentric radial, but supported if centers aren't equal
|
|
63
|
+
rotate?: number; pivotX?: number; pivotY?: number;
|
|
64
|
+
colors: GradientStop[];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type borderPosition = 'all' | 'top' | 'left' | 'right' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Configuration options for the canvas.
|
|
71
|
+
* @param {number} width - The width of the canvas.
|
|
72
|
+
* @param {number} height - The height of the canvas.
|
|
73
|
+
* @param {string} customBg - The URL or local path to the custom background image.
|
|
74
|
+
* @param {string} colorBg - The background color of the canvas.
|
|
75
|
+
* @param {object} gradientBg - The gradient settings for the canvas background.
|
|
76
|
+
* @param {number | string} borderRadius - The border radius of the canvas.
|
|
77
|
+
*/
|
|
78
|
+
export interface CanvasConfig {
|
|
79
|
+
width?: number;
|
|
80
|
+
height?: number;
|
|
81
|
+
x?: number;
|
|
82
|
+
y?: number;
|
|
83
|
+
|
|
84
|
+
customBg?: {
|
|
85
|
+
source: string
|
|
86
|
+
inherit?: boolean;
|
|
87
|
+
fit?: 'fill' | 'contain' | 'cover';
|
|
88
|
+
align?: 'center' | 'top' | 'bottom' | 'left' | 'right'
|
|
89
|
+
| 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
90
|
+
filters?: ImageFilter[]; // NEW: Apply filters to background image
|
|
91
|
+
opacity?: number; // NEW: Background image opacity
|
|
92
|
+
};
|
|
93
|
+
videoBg?: {
|
|
94
|
+
source: string | Buffer; // Video file path, URL, or Buffer
|
|
95
|
+
frame?: number; // Extract specific frame number (default: 0)
|
|
96
|
+
time?: number; // Extract frame at specific time in seconds (overrides frame if provided)
|
|
97
|
+
loop?: boolean; // Loop video (default: false)
|
|
98
|
+
autoplay?: boolean; // Autoplay (default: false)
|
|
99
|
+
opacity?: number; // Video opacity (default: 1)
|
|
100
|
+
format?: 'jpg' | 'png'; // Output format (default: 'jpg')
|
|
101
|
+
quality?: number; // JPEG quality 1-31, lower = better (default: 2)
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
colorBg?: string;
|
|
105
|
+
gradientBg?: gradient;
|
|
106
|
+
patternBg?: PatternOptions;
|
|
107
|
+
noiseBg?: { intensity?: number };
|
|
108
|
+
bgLayers?: Array<
|
|
109
|
+
{ type: "color"; value: string } |
|
|
110
|
+
{ type: "gradient"; value: gradient } |
|
|
111
|
+
{ type: "image"; source: string; opacity?: number } |
|
|
112
|
+
{ type: "pattern"; source: string; repeat?: string; opacity?: number } |
|
|
113
|
+
{ type: "noise"; intensity?: number }
|
|
114
|
+
>;
|
|
115
|
+
blendMode?: GlobalCompositeOperation;
|
|
116
|
+
|
|
117
|
+
opacity?: number;
|
|
118
|
+
blur?: number;
|
|
119
|
+
|
|
120
|
+
rotation?: number;
|
|
121
|
+
borderRadius?: number | "circular";
|
|
122
|
+
borderPosition?: borderPosition;
|
|
123
|
+
|
|
124
|
+
zoom?: {
|
|
125
|
+
scale?: number; // optional, defaults to 1
|
|
126
|
+
centerX?: number;
|
|
127
|
+
centerY?: number;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
stroke?: {
|
|
132
|
+
color?: string;
|
|
133
|
+
blur?: number;
|
|
134
|
+
width?: number;
|
|
135
|
+
position?: number;
|
|
136
|
+
borderRadius?: number | "circular";
|
|
137
|
+
borderPosition?: borderPosition;
|
|
138
|
+
gradient?: gradient;
|
|
139
|
+
style?: 'solid' | 'dashed' | 'dotted' | 'groove' | 'ridge' | 'double';
|
|
140
|
+
};
|
|
141
|
+
shadow?: {
|
|
142
|
+
color?: string;
|
|
143
|
+
offsetX?: number;
|
|
144
|
+
offsetY?: number;
|
|
145
|
+
blur?: number;
|
|
146
|
+
opacity?: number;
|
|
147
|
+
borderRadius?: number | "circular";
|
|
148
|
+
gradient?: gradient;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Properties of an image or shape to be drawn on the canvas.
|
|
154
|
+
* @param {string} source - URL or path to the image or shape name.
|
|
155
|
+
* @param {number} width - The width of the image or shape.
|
|
156
|
+
* @param {number} height - The height of the image or shape.
|
|
157
|
+
* @param {number} x - The x-coordinate of the image or shape.
|
|
158
|
+
* @param {number} y - The y-coordinate of the image or shape.
|
|
159
|
+
* @param {boolean} isFilled - Whether the shape is filled or not (Only applicable if source is a shape name).
|
|
160
|
+
* @param {string} color - The color of the shape (Only applicable if source is a shape name).
|
|
161
|
+
* @param {object} gradient - The gradient settings for the shape (Only applicable if source is a shape name).
|
|
162
|
+
* @param {number} rotation - Rotation angle in degrees.
|
|
163
|
+
* @param {number | string} borderRadius - The border radius of the image or shape.
|
|
164
|
+
* @param {object} stroke - The stroke properties.
|
|
165
|
+
* @param {string} stroke.color - The color of the stroke.
|
|
166
|
+
* @param {number} stroke.width - The width of the stroke.
|
|
167
|
+
* @param {number} stroke.position - Space between stroke and the image it's stroked on.
|
|
168
|
+
* @param {number | string} stroke.borderRadius - The border radius of the stroke.
|
|
169
|
+
* @param {object} shadow - The shadow properties.
|
|
170
|
+
* @param {string} shadow.color - The color of the shadow.
|
|
171
|
+
* @param {number} shadow.offsetX - The horizontal offset of the shadow.
|
|
172
|
+
* @param {number} shadow.offsetY - The vertical offset of the shadow.
|
|
173
|
+
* @param {number} shadow.blur - The blur radius of the shadow.
|
|
174
|
+
* @param {number} shadow.opacity - The opacity of the shadow.
|
|
175
|
+
* @param {number | string} shadow.borderRadius - The border radius of the shadow.
|
|
176
|
+
*/
|
|
177
|
+
export type ShapeType = 'rectangle' | 'square' | 'circle' | 'triangle' | 'trapezium' | 'star' | 'heart' | 'polygon';
|
|
178
|
+
|
|
179
|
+
export interface ShapeProperties {
|
|
180
|
+
fill?: boolean;
|
|
181
|
+
color?: string;
|
|
182
|
+
gradient?: gradient;
|
|
183
|
+
points?: { x: number; y: number }[]; // for polygon
|
|
184
|
+
radius?: number; // for circle
|
|
185
|
+
sides?: number; // for polygon
|
|
186
|
+
innerRadius?: number; // for star
|
|
187
|
+
outerRadius?: number; // for star
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface ImageProperties {
|
|
191
|
+
// required
|
|
192
|
+
source: string | Buffer | ShapeType;
|
|
193
|
+
x: number;
|
|
194
|
+
y: number;
|
|
195
|
+
|
|
196
|
+
// size (if omitted and inherit=true -> use intrinsic)
|
|
197
|
+
width?: number;
|
|
198
|
+
height?: number;
|
|
199
|
+
inherit?: boolean;
|
|
200
|
+
|
|
201
|
+
// fitting
|
|
202
|
+
fit?: FitMode; // default 'fill'
|
|
203
|
+
align?: AlignMode; // default 'center'
|
|
204
|
+
|
|
205
|
+
// visuals
|
|
206
|
+
rotation?: number; // deg around box center
|
|
207
|
+
opacity?: number; // bitmap alpha
|
|
208
|
+
blur?: number; // bitmap blur px
|
|
209
|
+
borderRadius?: number | 'circular';
|
|
210
|
+
borderPosition?: string;
|
|
211
|
+
|
|
212
|
+
// image filters
|
|
213
|
+
filters?: ImageFilter[];
|
|
214
|
+
filterIntensity?: number; // Global filter intensity multiplier (default: 1)
|
|
215
|
+
filterOrder?: 'pre' | 'post'; // Apply before or after transformations (default: 'post')
|
|
216
|
+
|
|
217
|
+
// image masking
|
|
218
|
+
mask?: {
|
|
219
|
+
source: string | Buffer; // Mask image
|
|
220
|
+
mode?: 'alpha' | 'luminance' | 'inverse'; // Mask mode (default: 'alpha')
|
|
221
|
+
};
|
|
222
|
+
clipPath?: Array<{ x: number; y: number }>; // Custom clipping path polygon
|
|
223
|
+
|
|
224
|
+
// image distortion/transform
|
|
225
|
+
distortion?: {
|
|
226
|
+
type: 'perspective' | 'warp' | 'bulge' | 'pinch';
|
|
227
|
+
points?: Array<{ x: number; y: number }>; // Control points for perspective/warp
|
|
228
|
+
intensity?: number; // Intensity for bulge/pinch (default: 0.5)
|
|
229
|
+
};
|
|
230
|
+
meshWarp?: {
|
|
231
|
+
gridX?: number; // Grid divisions X (default: 10)
|
|
232
|
+
gridY?: number; // Grid divisions Y (default: 10)
|
|
233
|
+
controlPoints?: Array<Array<{ x: number; y: number }>>; // Control point grid
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// image effects stack
|
|
237
|
+
effects?: {
|
|
238
|
+
vignette?: { intensity: number; size: number }; // Vignette effect (0-1, 0-1)
|
|
239
|
+
lensFlare?: { x: number; y: number; intensity: number }; // Lens flare position and intensity
|
|
240
|
+
chromaticAberration?: { intensity: number }; // Chromatic aberration (0-1)
|
|
241
|
+
filmGrain?: { intensity: number }; // Film grain effect (0-1)
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// shape properties (when source is a shape)
|
|
245
|
+
shape?: ShapeProperties;
|
|
246
|
+
|
|
247
|
+
// independent passes
|
|
248
|
+
shadow?: ShadowOptions;
|
|
249
|
+
stroke?: StrokeOptions;
|
|
250
|
+
boxBackground?: BoxBackground; // under bitmap, inside clip
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface ImageFilter {
|
|
254
|
+
type: 'gaussianBlur' | 'motionBlur' | 'radialBlur' | 'sharpen' | 'noise' | 'grain' |
|
|
255
|
+
'edgeDetection' | 'emboss' | 'invert' | 'grayscale' | 'sepia' | 'pixelate' |
|
|
256
|
+
'brightness' | 'contrast' | 'saturation' | 'hueShift' | 'posterize';
|
|
257
|
+
intensity?: number;
|
|
258
|
+
radius?: number;
|
|
259
|
+
angle?: number; // for motion blur
|
|
260
|
+
centerX?: number; // for radial blur
|
|
261
|
+
centerY?: number; // for radial blur
|
|
262
|
+
value?: number; // for brightness, contrast, saturation, hue shift
|
|
263
|
+
levels?: number; // for posterize
|
|
264
|
+
size?: number; // for pixelate
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Enhanced text properties interface with comprehensive styling options
|
|
271
|
+
*/
|
|
272
|
+
export interface TextProperties {
|
|
273
|
+
// === CORE TEXT PROPERTIES ===
|
|
274
|
+
/** Text content to render */
|
|
275
|
+
text: string;
|
|
276
|
+
/** X position on canvas */
|
|
277
|
+
x: number;
|
|
278
|
+
/** Y position on canvas */
|
|
279
|
+
y: number;
|
|
280
|
+
|
|
281
|
+
// === FONT MANAGEMENT ===
|
|
282
|
+
/** Font configuration object */
|
|
283
|
+
font?: {
|
|
284
|
+
/** Font size in pixels (default: 16) */
|
|
285
|
+
size?: number;
|
|
286
|
+
/** Font family name (e.g., 'Arial', 'Helvetica', 'Times New Roman') */
|
|
287
|
+
family?: string;
|
|
288
|
+
/** Custom font name (used with fontPath) */
|
|
289
|
+
name?: string;
|
|
290
|
+
/** Path to custom font file (.ttf, .otf, .woff, etc.) */
|
|
291
|
+
path?: string;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// === LEGACY FONT PROPERTIES (for backward compatibility) ===
|
|
295
|
+
/** @deprecated Use font.size instead */
|
|
296
|
+
fontSize?: number;
|
|
297
|
+
/** @deprecated Use font.family instead */
|
|
298
|
+
fontFamily?: string;
|
|
299
|
+
/** @deprecated Use font.name instead */
|
|
300
|
+
fontName?: string;
|
|
301
|
+
/** @deprecated Use font.path instead */
|
|
302
|
+
fontPath?: string;
|
|
303
|
+
|
|
304
|
+
// === TEXT DECORATION ===
|
|
305
|
+
/** Make text bold */
|
|
306
|
+
bold?: boolean;
|
|
307
|
+
/** Make text italic */
|
|
308
|
+
italic?: boolean;
|
|
309
|
+
/** Add underline decoration */
|
|
310
|
+
underline?: boolean | {
|
|
311
|
+
/** Underline color */
|
|
312
|
+
color?: string;
|
|
313
|
+
/** Underline gradient (overrides color) */
|
|
314
|
+
gradient?: gradient;
|
|
315
|
+
/** Underline width (default: 1px) */
|
|
316
|
+
width?: number;
|
|
317
|
+
};
|
|
318
|
+
/** Add overline decoration */
|
|
319
|
+
overline?: boolean | {
|
|
320
|
+
/** Overline color */
|
|
321
|
+
color?: string;
|
|
322
|
+
/** Overline gradient (overrides color) */
|
|
323
|
+
gradient?: gradient;
|
|
324
|
+
/** Overline width (default: 1px) */
|
|
325
|
+
width?: number;
|
|
326
|
+
};
|
|
327
|
+
/** Add strikethrough decoration */
|
|
328
|
+
strikethrough?: boolean | {
|
|
329
|
+
/** Strikethrough color */
|
|
330
|
+
color?: string;
|
|
331
|
+
/** Strikethrough gradient (overrides color) */
|
|
332
|
+
gradient?: gradient;
|
|
333
|
+
/** Strikethrough width (default: 1px) */
|
|
334
|
+
width?: number;
|
|
335
|
+
};
|
|
336
|
+
/** Highlight text with background color */
|
|
337
|
+
highlight?: {
|
|
338
|
+
/** Highlight color (hex, rgb, rgba, hsl, etc.) */
|
|
339
|
+
color?: string;
|
|
340
|
+
/** Highlight gradient (overrides color) */
|
|
341
|
+
gradient?: gradient;
|
|
342
|
+
/** Highlight opacity (0-1, default: 0.3) */
|
|
343
|
+
opacity?: number;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// === SPACING & POSITIONING ===
|
|
347
|
+
/** Line height multiplier (default: 1.4) */
|
|
348
|
+
lineHeight?: number;
|
|
349
|
+
/** Space between letters in pixels */
|
|
350
|
+
letterSpacing?: number;
|
|
351
|
+
/** Space between words in pixels */
|
|
352
|
+
wordSpacing?: number;
|
|
353
|
+
/** Maximum width for text wrapping */
|
|
354
|
+
maxWidth?: number;
|
|
355
|
+
/** Maximum height for text (truncates with ellipsis) */
|
|
356
|
+
maxHeight?: number;
|
|
357
|
+
|
|
358
|
+
// === TEXT ALIGNMENT ===
|
|
359
|
+
/** Horizontal text alignment */
|
|
360
|
+
textAlign?: 'left' | 'center' | 'right' | 'start' | 'end';
|
|
361
|
+
/** Vertical text baseline */
|
|
362
|
+
textBaseline?: 'alphabetic' | 'bottom' | 'hanging' | 'ideographic' | 'middle' | 'top';
|
|
363
|
+
|
|
364
|
+
// === TEXT COLORING ===
|
|
365
|
+
/** Text color (hex, rgb, rgba, hsl, etc.) */
|
|
366
|
+
color?: string;
|
|
367
|
+
/** Gradient fill for text */
|
|
368
|
+
gradient?: gradient;
|
|
369
|
+
/** Text opacity (0-1, default: 1) */
|
|
370
|
+
opacity?: number;
|
|
371
|
+
|
|
372
|
+
// === TEXT EFFECTS ===
|
|
373
|
+
/** Text glow effect */
|
|
374
|
+
glow?: {
|
|
375
|
+
/** Glow color */
|
|
376
|
+
color?: string;
|
|
377
|
+
/** Glow gradient (overrides color) */
|
|
378
|
+
gradient?: gradient;
|
|
379
|
+
/** Glow intensity/blur radius */
|
|
380
|
+
intensity?: number;
|
|
381
|
+
/** Glow opacity (0-1) */
|
|
382
|
+
opacity?: number;
|
|
383
|
+
};
|
|
384
|
+
/** Text shadow effect */
|
|
385
|
+
shadow?: {
|
|
386
|
+
/** Shadow color */
|
|
387
|
+
color?: string;
|
|
388
|
+
/** Horizontal shadow offset */
|
|
389
|
+
offsetX?: number;
|
|
390
|
+
/** Vertical shadow offset */
|
|
391
|
+
offsetY?: number;
|
|
392
|
+
/** Shadow blur radius */
|
|
393
|
+
blur?: number;
|
|
394
|
+
/** Shadow opacity (0-1) */
|
|
395
|
+
opacity?: number;
|
|
396
|
+
};
|
|
397
|
+
/** Text stroke/outline */
|
|
398
|
+
stroke?: {
|
|
399
|
+
/** Stroke color */
|
|
400
|
+
color?: string;
|
|
401
|
+
/** Stroke width in pixels */
|
|
402
|
+
width?: number;
|
|
403
|
+
/** Gradient stroke */
|
|
404
|
+
gradient?: gradient;
|
|
405
|
+
/** Stroke opacity (0-1) */
|
|
406
|
+
opacity?: number;
|
|
407
|
+
/** Stroke style */
|
|
408
|
+
style?: 'solid' | 'dashed' | 'dotted' | 'groove' | 'ridge' | 'double';
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// === TRANSFORMATIONS ===
|
|
412
|
+
/** Text rotation in degrees */
|
|
413
|
+
rotation?: number;
|
|
414
|
+
|
|
415
|
+
// === TEXT PATH/CURVE FOLLOWING ===
|
|
416
|
+
/** Path for text to follow */
|
|
417
|
+
path?: {
|
|
418
|
+
type: 'line' | 'arc' | 'bezier' | 'quadratic';
|
|
419
|
+
points: Array<{ x: number; y: number }>;
|
|
420
|
+
offset?: number; // Distance from path (default: 0)
|
|
421
|
+
};
|
|
422
|
+
/** Render text along path */
|
|
423
|
+
textOnPath?: boolean;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Legacy TextObject interface for backward compatibility
|
|
428
|
+
* @deprecated Use TextProperties instead
|
|
429
|
+
*/
|
|
430
|
+
export interface TextObject extends TextProperties {
|
|
431
|
+
/** @deprecated Use bold instead */
|
|
432
|
+
isBold?: boolean;
|
|
433
|
+
/** @deprecated Use outlined instead of stroke */
|
|
434
|
+
outlined?: boolean;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Options for creating a GIF.
|
|
439
|
+
* @param outputFormat The format of the output ('file', 'base64', 'attachment', or 'buffer').
|
|
440
|
+
* @param outputFile The file path if output format is 'file'.
|
|
441
|
+
* @param width The width of the GIF.
|
|
442
|
+
* @param height The height of the GIF.
|
|
443
|
+
* @param repeat The number of times the GIF should repeat.
|
|
444
|
+
* @param quality The quality of the GIF.
|
|
445
|
+
* @param delay The delay between frames in milliseconds.
|
|
446
|
+
* @param watermark The watermark settings.
|
|
447
|
+
* @param textOverlay The text overlay settings.
|
|
448
|
+
* @param basDir The base directory for files.
|
|
449
|
+
*/
|
|
450
|
+
export interface GIFOptions {
|
|
451
|
+
outputFormat: 'file' | 'base64' | 'attachment' | 'buffer' | string;
|
|
452
|
+
outputFile?: string;
|
|
453
|
+
width?: number;
|
|
454
|
+
height?: number;
|
|
455
|
+
repeat?: number;
|
|
456
|
+
quality?: number;
|
|
457
|
+
delay?: number;
|
|
458
|
+
watermark?: {
|
|
459
|
+
enable: boolean;
|
|
460
|
+
url: string;
|
|
461
|
+
};
|
|
462
|
+
textOverlay?: {
|
|
463
|
+
text: string;
|
|
464
|
+
fontName?: string;
|
|
465
|
+
fontPath?: string;
|
|
466
|
+
fontSize?: number;
|
|
467
|
+
fontColor?: string;
|
|
468
|
+
x?: number;
|
|
469
|
+
y?: number;
|
|
470
|
+
};
|
|
471
|
+
basDir?: any;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Results of creating a GIF.
|
|
476
|
+
* @param buffer The buffer containing the GIF data.
|
|
477
|
+
* @param base64 The base64 representation of the GIF.
|
|
478
|
+
* @param attachment The attachment containing the GIF stream.
|
|
479
|
+
*/
|
|
480
|
+
export interface GIFResults {
|
|
481
|
+
buffer?: Buffer;
|
|
482
|
+
base64?: string;
|
|
483
|
+
attachment?: { attachment: NodeJS.ReadableStream | any; name: string };
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Custom options for drawing.
|
|
488
|
+
* @param startCoordinates The starting coordinates.
|
|
489
|
+
* @param endCoordinates The ending coordinates.
|
|
490
|
+
* @param lineStyle The style of the line.
|
|
491
|
+
*/
|
|
492
|
+
export interface CustomOptions {
|
|
493
|
+
startCoordinates: {
|
|
494
|
+
x: number;
|
|
495
|
+
y: number;
|
|
496
|
+
};
|
|
497
|
+
endCoordinates: {
|
|
498
|
+
x: number;
|
|
499
|
+
y: number;
|
|
500
|
+
};
|
|
501
|
+
// Advanced path options
|
|
502
|
+
path?: {
|
|
503
|
+
type: 'smooth' | 'bezier' | 'catmull-rom';
|
|
504
|
+
tension?: number; // For smooth/catmull-rom (default: 0.5)
|
|
505
|
+
closed?: boolean; // Close the path (default: false)
|
|
506
|
+
};
|
|
507
|
+
// Arrow markers
|
|
508
|
+
arrow?: {
|
|
509
|
+
start?: boolean; // Arrow at start (default: false)
|
|
510
|
+
end?: boolean; // Arrow at end (default: false)
|
|
511
|
+
size?: number; // Arrow size (default: 10)
|
|
512
|
+
style?: 'filled' | 'outline'; // Arrow style (default: 'filled')
|
|
513
|
+
color?: string; // Arrow color (default: line color)
|
|
514
|
+
};
|
|
515
|
+
// Path markers
|
|
516
|
+
markers?: Array<{
|
|
517
|
+
position: number; // 0-1 along path
|
|
518
|
+
shape: 'circle' | 'square' | 'diamond' | 'arrow';
|
|
519
|
+
size: number;
|
|
520
|
+
color: string;
|
|
521
|
+
}>;
|
|
522
|
+
lineStyle?: {
|
|
523
|
+
width?: number;
|
|
524
|
+
color?: string;
|
|
525
|
+
gradient?: gradient;
|
|
526
|
+
lineRadius?: number | string;
|
|
527
|
+
lineJoin?: 'round' | 'bevel' | 'miter';
|
|
528
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
529
|
+
singleLine?: boolean;
|
|
530
|
+
lineDash?: {
|
|
531
|
+
dashArray?: number[];
|
|
532
|
+
offset?: number;
|
|
533
|
+
};
|
|
534
|
+
// Line patterns
|
|
535
|
+
pattern?: {
|
|
536
|
+
type: 'dots' | 'dashes' | 'custom';
|
|
537
|
+
segments?: number[]; // For custom pattern
|
|
538
|
+
offset?: number; // Pattern offset
|
|
539
|
+
};
|
|
540
|
+
texture?: string | Buffer; // Texture image for line
|
|
541
|
+
stroke?: {
|
|
542
|
+
color?: string;
|
|
543
|
+
gradient?: gradient;
|
|
544
|
+
width?: number;
|
|
545
|
+
lineRadius?: number | string;
|
|
546
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
547
|
+
};
|
|
548
|
+
shadow?: {
|
|
549
|
+
offsetX?: number;
|
|
550
|
+
offsetY?: number;
|
|
551
|
+
blur?: number;
|
|
552
|
+
color?: string;
|
|
553
|
+
gradient?: gradient;
|
|
554
|
+
lineRadius?: number | string;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export interface ChartData {
|
|
560
|
+
height?: number;
|
|
561
|
+
width?: number;
|
|
562
|
+
widthPerc?: number;
|
|
563
|
+
heightPerc?: number;
|
|
564
|
+
title?: {
|
|
565
|
+
title?: string;
|
|
566
|
+
color?: string;
|
|
567
|
+
size?: number;
|
|
568
|
+
};
|
|
569
|
+
bg?: {
|
|
570
|
+
image?: string;
|
|
571
|
+
bgColor?: string;
|
|
572
|
+
};
|
|
573
|
+
grid?: {
|
|
574
|
+
enable: boolean;
|
|
575
|
+
color?: string;
|
|
576
|
+
width?: number;
|
|
577
|
+
};
|
|
578
|
+
axis?: {
|
|
579
|
+
color?: string;
|
|
580
|
+
size?: number;
|
|
581
|
+
};
|
|
582
|
+
labels?: {
|
|
583
|
+
color?: string;
|
|
584
|
+
fontSize?: number;
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export interface DataPoint {
|
|
589
|
+
label: string;
|
|
590
|
+
barColor?: string;
|
|
591
|
+
stroke?: {
|
|
592
|
+
color?: string;
|
|
593
|
+
width?: number;
|
|
594
|
+
}
|
|
595
|
+
value: number;
|
|
596
|
+
position: {
|
|
597
|
+
startsXLabel: number;
|
|
598
|
+
endsXLabel: number;
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
export interface barChart_1 {
|
|
603
|
+
chartData?: ChartData;
|
|
604
|
+
xLabels: number[];
|
|
605
|
+
yLabels: number[];
|
|
606
|
+
data: {
|
|
607
|
+
xAxis: DataPoint[];
|
|
608
|
+
yAxis: number[];
|
|
609
|
+
keys?: { [color: string]: string };
|
|
610
|
+
keyColor?: string;
|
|
611
|
+
xTitle?: string;
|
|
612
|
+
yTitle?: string;
|
|
613
|
+
labelStyle?: {
|
|
614
|
+
color?: string;
|
|
615
|
+
size?: number;
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
export interface bgConfig {
|
|
622
|
+
width?: number;
|
|
623
|
+
height?: number;
|
|
624
|
+
bgcolor?: string;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export interface KeyBoxConfig {
|
|
628
|
+
width?: number;
|
|
629
|
+
height?: number;
|
|
630
|
+
radius?: number;
|
|
631
|
+
bgcolor?: string;
|
|
632
|
+
x?: number;
|
|
633
|
+
y?: number;
|
|
634
|
+
content?: KeyBoxContent;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
export interface KeyBoxContent {
|
|
638
|
+
keyTitle?: {
|
|
639
|
+
text?: string;
|
|
640
|
+
fontSize?: number;
|
|
641
|
+
x?: number;
|
|
642
|
+
y?: number;
|
|
643
|
+
};
|
|
644
|
+
keys?: {
|
|
645
|
+
x?: number;
|
|
646
|
+
y?: number;
|
|
647
|
+
fontSize?: number;
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export interface StrokeConfig {
|
|
652
|
+
color?: string;
|
|
653
|
+
size?: number;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export interface TitleConfig {
|
|
657
|
+
text?: string;
|
|
658
|
+
color?: string;
|
|
659
|
+
fontSize?: number;
|
|
660
|
+
x?: number;
|
|
661
|
+
y?: number;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export interface PieDataConfig {
|
|
665
|
+
x?: number;
|
|
666
|
+
y?: number;
|
|
667
|
+
stroke?: StrokeConfig;
|
|
668
|
+
title?: TitleConfig;
|
|
669
|
+
boxes?: {
|
|
670
|
+
labelDistance?: number;
|
|
671
|
+
width?: number;
|
|
672
|
+
height?: number;
|
|
673
|
+
fontSize?: number;
|
|
674
|
+
labelColor?: string;
|
|
675
|
+
boxColor?: string;
|
|
676
|
+
strokeColor?: string;
|
|
677
|
+
|
|
678
|
+
};
|
|
679
|
+
radius?: number;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export interface PieConfig {
|
|
683
|
+
canvas?: bgConfig;
|
|
684
|
+
keyBox?: KeyBoxConfig;
|
|
685
|
+
pieData?: PieDataConfig;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
export interface DataItem {
|
|
689
|
+
label: string;
|
|
690
|
+
color: string;
|
|
691
|
+
value: number;
|
|
692
|
+
key: string;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export interface PieChartData {
|
|
696
|
+
data?: DataItem[];
|
|
697
|
+
pieConfig?: PieConfig;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
export interface DataPoint {
|
|
702
|
+
label: string;
|
|
703
|
+
y: number;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
export interface LineChartConfig {
|
|
707
|
+
yLabels: string[];
|
|
708
|
+
fillArea: { color: string }[];
|
|
709
|
+
lineColor: string[];
|
|
710
|
+
plot?: {
|
|
711
|
+
enable: boolean;
|
|
712
|
+
color: string[];
|
|
713
|
+
size: number;
|
|
714
|
+
};
|
|
715
|
+
yaxisLabel?: {
|
|
716
|
+
label?: string;
|
|
717
|
+
x?: number;
|
|
718
|
+
y?: number;
|
|
719
|
+
color?: string;
|
|
720
|
+
fontSize?: string;
|
|
721
|
+
};
|
|
722
|
+
lineTension?: number[];
|
|
723
|
+
grid?: {
|
|
724
|
+
type: 'vertical' | 'horizontal' | 'both';
|
|
725
|
+
color: string;
|
|
726
|
+
width: number;
|
|
727
|
+
};
|
|
728
|
+
keys?: { [color: string]: string };
|
|
729
|
+
keysConfig?: {
|
|
730
|
+
radius?: number;
|
|
731
|
+
keyPadding?: number;
|
|
732
|
+
textPadding?: number;
|
|
733
|
+
lineWidth?: number;
|
|
734
|
+
fontColor?: string;
|
|
735
|
+
}
|
|
736
|
+
canvas?: {
|
|
737
|
+
bgColor?: string;
|
|
738
|
+
fontColor?: string;
|
|
739
|
+
fontSize?: number;
|
|
740
|
+
width?: number;
|
|
741
|
+
height?: number;
|
|
742
|
+
image?: string;
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
export interface cropCoordinate {
|
|
749
|
+
from: { x: number; y: number };
|
|
750
|
+
to: { x: number; y: number };
|
|
751
|
+
tension?: number;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export interface cropOptions {
|
|
755
|
+
coordinates: cropCoordinate[];
|
|
756
|
+
imageSource: string;
|
|
757
|
+
crop: 'inner' | 'outer';
|
|
758
|
+
radius: number | "circular"
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
export interface GradientConfig{
|
|
763
|
+
type: 'linear' | 'radial';
|
|
764
|
+
startX?: number;
|
|
765
|
+
startY?: number;
|
|
766
|
+
endX?: number;
|
|
767
|
+
endY?: number;
|
|
768
|
+
startRadius?: number;
|
|
769
|
+
endRadius?: number;
|
|
770
|
+
angle?: number;
|
|
771
|
+
colors: {
|
|
772
|
+
stop: number;
|
|
773
|
+
color: string;
|
|
774
|
+
}[];
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
export interface Frame{
|
|
778
|
+
backgroundColor?: string;
|
|
779
|
+
gradient?: GradientConfig;
|
|
780
|
+
pattern?: {
|
|
781
|
+
source: string;
|
|
782
|
+
repeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
|
|
783
|
+
};
|
|
784
|
+
source?: string;
|
|
785
|
+
blendMode?: GlobalCompositeOperation;
|
|
786
|
+
transformations?: {
|
|
787
|
+
scaleX?: number;
|
|
788
|
+
scaleY?: number;
|
|
789
|
+
rotate?: number;
|
|
790
|
+
translateX?: number;
|
|
791
|
+
translateY?: number;
|
|
792
|
+
};
|
|
793
|
+
duration?: number;
|
|
794
|
+
width?: number;
|
|
795
|
+
height?: number;
|
|
796
|
+
onDrawCustom?: (ctx: SKRSContext2D, canvas: Canvas) => void;
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Enhanced pattern options supporting all pattern types
|
|
802
|
+
*/
|
|
803
|
+
export interface PatternOptions {
|
|
804
|
+
// === PATTERN TYPE ===
|
|
805
|
+
/** Pattern type: built-in patterns or custom image */
|
|
806
|
+
type: 'grid' | 'dots' | 'diagonal' | 'stripes' | 'waves' | 'crosses' |
|
|
807
|
+
'hexagons' | 'checkerboard' | 'diamonds' | 'triangles' | 'stars' | 'polka' | 'custom';
|
|
808
|
+
|
|
809
|
+
// === PATTERN COLORS ===
|
|
810
|
+
/** Primary pattern color (default: '#ffffff') */
|
|
811
|
+
color?: string;
|
|
812
|
+
/** Secondary pattern color for two-color patterns (default: 'transparent') */
|
|
813
|
+
secondaryColor?: string;
|
|
814
|
+
/** Pattern opacity (0-1, default: 0.3) */
|
|
815
|
+
opacity?: number;
|
|
816
|
+
|
|
817
|
+
// === PATTERN SIZING ===
|
|
818
|
+
/** Pattern element size in pixels (default: 20) */
|
|
819
|
+
size?: number;
|
|
820
|
+
/** Spacing between pattern elements in pixels (default: 10) */
|
|
821
|
+
spacing?: number;
|
|
822
|
+
/** Pattern rotation angle in degrees (default: 0) */
|
|
823
|
+
rotation?: number;
|
|
824
|
+
|
|
825
|
+
// === CUSTOM PATTERN ===
|
|
826
|
+
/** Custom pattern image path/URL (for type: 'custom') */
|
|
827
|
+
customPatternImage?: string;
|
|
828
|
+
/** Custom pattern repeat mode (default: 'repeat') */
|
|
829
|
+
repeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
|
|
830
|
+
/** Custom pattern scale multiplier (default: 1) */
|
|
831
|
+
scale?: number;
|
|
832
|
+
|
|
833
|
+
// === PATTERN POSITIONING ===
|
|
834
|
+
/** Pattern offset X position (default: 0) */
|
|
835
|
+
offsetX?: number;
|
|
836
|
+
/** Pattern offset Y position (default: 0) */
|
|
837
|
+
offsetY?: number;
|
|
838
|
+
|
|
839
|
+
// === ADVANCED OPTIONS ===
|
|
840
|
+
/** Pattern blend mode (default: 'overlay') */
|
|
841
|
+
blendMode?: GlobalCompositeOperation;
|
|
842
|
+
/** Pattern gradient (overrides color) */
|
|
843
|
+
gradient?: GradientConfig;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
// Batch operation types
|
|
848
|
+
export interface BatchOperation {
|
|
849
|
+
type: 'canvas' | 'image' | 'text' | 'chart';
|
|
850
|
+
config: any;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
export interface ChainOperation {
|
|
854
|
+
method: string;
|
|
855
|
+
args: any[];
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// Image stitching options
|
|
859
|
+
export interface StitchOptions {
|
|
860
|
+
direction?: 'horizontal' | 'vertical' | 'grid';
|
|
861
|
+
overlap?: number; // Percentage overlap for auto-alignment (0-100)
|
|
862
|
+
blend?: boolean; // Blend overlapping areas (default: false)
|
|
863
|
+
spacing?: number; // Spacing between images in pixels (default: 0)
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// Collage layout options
|
|
867
|
+
export interface CollageLayout {
|
|
868
|
+
type: 'grid' | 'masonry' | 'carousel' | 'custom';
|
|
869
|
+
columns?: number;
|
|
870
|
+
rows?: number;
|
|
871
|
+
spacing?: number;
|
|
872
|
+
background?: string;
|
|
873
|
+
borderRadius?: number;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// Image compression options
|
|
877
|
+
export interface CompressionOptions {
|
|
878
|
+
quality?: number; // 0-100 (default: 90)
|
|
879
|
+
format?: 'jpeg' | 'webp' | 'avif';
|
|
880
|
+
maxWidth?: number;
|
|
881
|
+
maxHeight?: number;
|
|
882
|
+
progressive?: boolean; // For JPEG (default: false)
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// Color palette extraction options
|
|
886
|
+
export interface PaletteOptions {
|
|
887
|
+
count?: number; // Number of colors (default: 10)
|
|
888
|
+
method?: 'kmeans' | 'median-cut' | 'octree';
|
|
889
|
+
format?: 'hex' | 'rgb' | 'hsl';
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
export interface ExtractFramesOptions {
|
|
893
|
+
outputDirectory?: string; // Directory to save frames
|
|
894
|
+
interval: number;
|
|
895
|
+
outputFormat?: 'jpg' | 'png';
|
|
896
|
+
frameSelection?: {
|
|
897
|
+
start?: number;
|
|
898
|
+
end?: number;
|
|
899
|
+
};
|
|
900
|
+
watermark?: string;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Options for resizing an image.
|
|
905
|
+
*/
|
|
906
|
+
export interface ResizeOptions {
|
|
907
|
+
imagePath: string;
|
|
908
|
+
size?: {
|
|
909
|
+
width?: number;
|
|
910
|
+
height?: number;
|
|
911
|
+
};
|
|
912
|
+
maintainAspectRatio?: boolean;
|
|
913
|
+
quality?: number;
|
|
914
|
+
outputFormat?: 'png' | 'jpeg';
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
export interface Point {
|
|
918
|
+
x: number;
|
|
919
|
+
y: number;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export interface Coordinate {
|
|
923
|
+
from: Point;
|
|
924
|
+
to: Point;
|
|
925
|
+
tension?: number;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export interface CropOptions {
|
|
929
|
+
imageSource: string;
|
|
930
|
+
coordinates: Coordinate[];
|
|
931
|
+
crop: 'inner' | 'outer';
|
|
932
|
+
radius?: number | "circular" | null;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
export interface MaskOptions {
|
|
936
|
+
type?: "alpha" | "grayscale" | "color";
|
|
937
|
+
threshold?: number;
|
|
938
|
+
invert?: boolean;
|
|
939
|
+
colorKey?: string;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
export interface BlendOptions {
|
|
943
|
+
type?: "linear" | "radial" | "conic";
|
|
944
|
+
angle?: number;
|
|
945
|
+
colors: { stop: number; color: string }[];
|
|
946
|
+
blendMode?: "multiply" | "overlay" | "screen" | "darken" | "lighten" | "difference";
|
|
947
|
+
maskSource?: string | Buffer | PathLike | Uint8Array;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// Advanced Save Options
|
|
951
|
+
export interface SaveOptions {
|
|
952
|
+
/** Output directory path (default: './output') */
|
|
953
|
+
directory?: string;
|
|
954
|
+
/** File name or name pattern (default: auto-generated timestamp) */
|
|
955
|
+
filename?: string;
|
|
956
|
+
/** File format/extension (default: 'png') */
|
|
957
|
+
format?: 'png' | 'jpg' | 'jpeg' | 'webp' | 'avif' | 'gif';
|
|
958
|
+
/** Quality for JPEG/WebP (0-100, default: 90) */
|
|
959
|
+
quality?: number;
|
|
960
|
+
/** Auto-create directory if it doesn't exist (default: true) */
|
|
961
|
+
createDirectory?: boolean;
|
|
962
|
+
/** Naming pattern: 'timestamp' | 'counter' | 'custom' (default: 'timestamp') */
|
|
963
|
+
naming?: 'timestamp' | 'counter' | 'custom';
|
|
964
|
+
/** Counter starting value (for 'counter' naming, default: 1) */
|
|
965
|
+
counterStart?: number;
|
|
966
|
+
/** Prefix for filename (default: '') */
|
|
967
|
+
prefix?: string;
|
|
968
|
+
/** Suffix for filename (default: '') */
|
|
969
|
+
suffix?: string;
|
|
970
|
+
/** Overwrite existing files (default: false) */
|
|
971
|
+
overwrite?: boolean;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
export interface SaveResult {
|
|
975
|
+
/** Full path to saved file */
|
|
976
|
+
path: string;
|
|
977
|
+
/** File name */
|
|
978
|
+
filename: string;
|
|
979
|
+
/** File size in bytes */
|
|
980
|
+
size: number;
|
|
981
|
+
/** File format */
|
|
982
|
+
format: string;
|
|
983
|
+
}
|