apexify.js 4.9.28 → 5.0.0
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/README.md +727 -456
- package/dist/cjs/Canvas/ApexPainter.d.ts +96 -145
- package/dist/cjs/Canvas/ApexPainter.d.ts.map +1 -1
- package/dist/cjs/Canvas/ApexPainter.js +1416 -420
- package/dist/cjs/Canvas/ApexPainter.js.map +1 -1
- package/dist/cjs/Canvas/utils/Charts/charts.d.ts +7 -2
- package/dist/cjs/Canvas/utils/Charts/charts.d.ts.map +1 -1
- package/dist/cjs/Canvas/utils/Charts/charts.js +3 -1
- package/dist/cjs/Canvas/utils/Charts/charts.js.map +1 -1
- package/dist/cjs/Canvas/utils/Custom/advancedLines.d.ts +75 -0
- package/dist/cjs/Canvas/utils/Custom/advancedLines.d.ts.map +1 -0
- package/dist/cjs/Canvas/utils/Custom/advancedLines.js +263 -0
- package/dist/cjs/Canvas/utils/Custom/advancedLines.js.map +1 -0
- package/dist/cjs/Canvas/utils/Custom/customLines.d.ts +2 -1
- package/dist/cjs/Canvas/utils/Custom/customLines.d.ts.map +1 -1
- package/dist/cjs/Canvas/utils/Custom/customLines.js +73 -6
- package/dist/cjs/Canvas/utils/Custom/customLines.js.map +1 -1
- package/dist/cjs/Canvas/utils/General/batchOperations.d.ts +17 -0
- package/dist/cjs/Canvas/utils/General/batchOperations.d.ts.map +1 -0
- package/dist/cjs/Canvas/utils/General/batchOperations.js +88 -0
- package/dist/cjs/Canvas/utils/General/batchOperations.js.map +1 -0
- package/dist/cjs/Canvas/utils/General/general functions.d.ts +25 -3
- package/dist/cjs/Canvas/utils/General/general functions.d.ts.map +1 -1
- package/dist/cjs/Canvas/utils/General/general functions.js +37 -9
- package/dist/cjs/Canvas/utils/General/general functions.js.map +1 -1
- package/dist/cjs/Canvas/utils/General/imageCompression.d.ts +19 -0
- package/dist/cjs/Canvas/utils/General/imageCompression.d.ts.map +1 -0
- package/dist/cjs/Canvas/utils/General/imageCompression.js +262 -0
- package/dist/cjs/Canvas/utils/General/imageCompression.js.map +1 -0
- package/dist/cjs/Canvas/utils/General/imageStitching.d.ts +20 -0
- package/dist/cjs/Canvas/utils/General/imageStitching.d.ts.map +1 -0
- package/dist/cjs/Canvas/utils/General/imageStitching.js +227 -0
- package/dist/cjs/Canvas/utils/General/imageStitching.js.map +1 -0
- package/dist/cjs/Canvas/utils/Image/imageEffects.d.ts +37 -0
- package/dist/cjs/Canvas/utils/Image/imageEffects.d.ts.map +1 -0
- package/dist/cjs/Canvas/utils/Image/imageEffects.js +128 -0
- package/dist/cjs/Canvas/utils/Image/imageEffects.js.map +1 -0
- package/dist/cjs/Canvas/utils/Image/imageMasking.d.ts +67 -0
- package/dist/cjs/Canvas/utils/Image/imageMasking.d.ts.map +1 -0
- package/dist/cjs/Canvas/utils/Image/imageMasking.js +276 -0
- package/dist/cjs/Canvas/utils/Image/imageMasking.js.map +1 -0
- package/dist/cjs/Canvas/utils/Image/imageProperties.d.ts.map +1 -1
- package/dist/cjs/Canvas/utils/Image/imageProperties.js +181 -2
- package/dist/cjs/Canvas/utils/Image/imageProperties.js.map +1 -1
- package/dist/cjs/Canvas/utils/Patterns/enhancedPatternRenderer.d.ts.map +1 -1
- package/dist/cjs/Canvas/utils/Patterns/enhancedPatternRenderer.js +16 -8
- package/dist/cjs/Canvas/utils/Patterns/enhancedPatternRenderer.js.map +1 -1
- package/dist/cjs/Canvas/utils/Texts/enhancedTextRenderer.d.ts +33 -0
- package/dist/cjs/Canvas/utils/Texts/enhancedTextRenderer.d.ts.map +1 -1
- package/dist/cjs/Canvas/utils/Texts/enhancedTextRenderer.js +237 -32
- package/dist/cjs/Canvas/utils/Texts/enhancedTextRenderer.js.map +1 -1
- package/dist/cjs/Canvas/utils/Texts/textPathRenderer.d.ts +17 -0
- package/dist/cjs/Canvas/utils/Texts/textPathRenderer.d.ts.map +1 -0
- package/dist/cjs/Canvas/utils/Texts/textPathRenderer.js +233 -0
- package/dist/cjs/Canvas/utils/Texts/textPathRenderer.js.map +1 -0
- package/dist/cjs/Canvas/utils/types.d.ts +171 -10
- package/dist/cjs/Canvas/utils/types.d.ts.map +1 -1
- package/dist/cjs/Canvas/utils/types.js.map +1 -1
- package/dist/cjs/Canvas/utils/utils.d.ts +9 -2
- package/dist/cjs/Canvas/utils/utils.d.ts.map +1 -1
- package/dist/cjs/Canvas/utils/utils.js +32 -1
- package/dist/cjs/Canvas/utils/utils.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/Canvas/ApexPainter.d.ts +96 -145
- package/dist/esm/Canvas/ApexPainter.d.ts.map +1 -1
- package/dist/esm/Canvas/ApexPainter.js +1416 -420
- package/dist/esm/Canvas/ApexPainter.js.map +1 -1
- package/dist/esm/Canvas/utils/Charts/charts.d.ts +7 -2
- package/dist/esm/Canvas/utils/Charts/charts.d.ts.map +1 -1
- package/dist/esm/Canvas/utils/Charts/charts.js +3 -1
- package/dist/esm/Canvas/utils/Charts/charts.js.map +1 -1
- package/dist/esm/Canvas/utils/Custom/advancedLines.d.ts +75 -0
- package/dist/esm/Canvas/utils/Custom/advancedLines.d.ts.map +1 -0
- package/dist/esm/Canvas/utils/Custom/advancedLines.js +263 -0
- package/dist/esm/Canvas/utils/Custom/advancedLines.js.map +1 -0
- package/dist/esm/Canvas/utils/Custom/customLines.d.ts +2 -1
- package/dist/esm/Canvas/utils/Custom/customLines.d.ts.map +1 -1
- package/dist/esm/Canvas/utils/Custom/customLines.js +73 -6
- package/dist/esm/Canvas/utils/Custom/customLines.js.map +1 -1
- package/dist/esm/Canvas/utils/General/batchOperations.d.ts +17 -0
- package/dist/esm/Canvas/utils/General/batchOperations.d.ts.map +1 -0
- package/dist/esm/Canvas/utils/General/batchOperations.js +88 -0
- package/dist/esm/Canvas/utils/General/batchOperations.js.map +1 -0
- package/dist/esm/Canvas/utils/General/general functions.d.ts +25 -3
- package/dist/esm/Canvas/utils/General/general functions.d.ts.map +1 -1
- package/dist/esm/Canvas/utils/General/general functions.js +37 -9
- package/dist/esm/Canvas/utils/General/general functions.js.map +1 -1
- package/dist/esm/Canvas/utils/General/imageCompression.d.ts +19 -0
- package/dist/esm/Canvas/utils/General/imageCompression.d.ts.map +1 -0
- package/dist/esm/Canvas/utils/General/imageCompression.js +262 -0
- package/dist/esm/Canvas/utils/General/imageCompression.js.map +1 -0
- package/dist/esm/Canvas/utils/General/imageStitching.d.ts +20 -0
- package/dist/esm/Canvas/utils/General/imageStitching.d.ts.map +1 -0
- package/dist/esm/Canvas/utils/General/imageStitching.js +227 -0
- package/dist/esm/Canvas/utils/General/imageStitching.js.map +1 -0
- package/dist/esm/Canvas/utils/Image/imageEffects.d.ts +37 -0
- package/dist/esm/Canvas/utils/Image/imageEffects.d.ts.map +1 -0
- package/dist/esm/Canvas/utils/Image/imageEffects.js +128 -0
- package/dist/esm/Canvas/utils/Image/imageEffects.js.map +1 -0
- package/dist/esm/Canvas/utils/Image/imageMasking.d.ts +67 -0
- package/dist/esm/Canvas/utils/Image/imageMasking.d.ts.map +1 -0
- package/dist/esm/Canvas/utils/Image/imageMasking.js +276 -0
- package/dist/esm/Canvas/utils/Image/imageMasking.js.map +1 -0
- package/dist/esm/Canvas/utils/Image/imageProperties.d.ts.map +1 -1
- package/dist/esm/Canvas/utils/Image/imageProperties.js +181 -2
- package/dist/esm/Canvas/utils/Image/imageProperties.js.map +1 -1
- package/dist/esm/Canvas/utils/Patterns/enhancedPatternRenderer.d.ts.map +1 -1
- package/dist/esm/Canvas/utils/Patterns/enhancedPatternRenderer.js +16 -8
- package/dist/esm/Canvas/utils/Patterns/enhancedPatternRenderer.js.map +1 -1
- package/dist/esm/Canvas/utils/Texts/enhancedTextRenderer.d.ts +33 -0
- package/dist/esm/Canvas/utils/Texts/enhancedTextRenderer.d.ts.map +1 -1
- package/dist/esm/Canvas/utils/Texts/enhancedTextRenderer.js +237 -32
- package/dist/esm/Canvas/utils/Texts/enhancedTextRenderer.js.map +1 -1
- package/dist/esm/Canvas/utils/Texts/textPathRenderer.d.ts +17 -0
- package/dist/esm/Canvas/utils/Texts/textPathRenderer.d.ts.map +1 -0
- package/dist/esm/Canvas/utils/Texts/textPathRenderer.js +233 -0
- package/dist/esm/Canvas/utils/Texts/textPathRenderer.js.map +1 -0
- package/dist/esm/Canvas/utils/types.d.ts +171 -10
- package/dist/esm/Canvas/utils/types.d.ts.map +1 -1
- package/dist/esm/Canvas/utils/types.js.map +1 -1
- package/dist/esm/Canvas/utils/utils.d.ts +9 -2
- package/dist/esm/Canvas/utils/utils.d.ts.map +1 -1
- package/dist/esm/Canvas/utils/utils.js +32 -1
- package/dist/esm/Canvas/utils/utils.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/Canvas/ApexPainter.ts +1309 -267
- package/lib/Canvas/utils/Charts/charts.ts +16 -7
- package/lib/Canvas/utils/Custom/advancedLines.ts +335 -0
- package/lib/Canvas/utils/Custom/customLines.ts +84 -9
- package/lib/Canvas/utils/General/batchOperations.ts +103 -0
- package/lib/Canvas/utils/General/general functions.ts +85 -41
- package/lib/Canvas/utils/General/imageCompression.ts +316 -0
- package/lib/Canvas/utils/General/imageStitching.ts +252 -0
- package/lib/Canvas/utils/Image/imageEffects.ts +175 -0
- package/lib/Canvas/utils/Image/imageMasking.ts +335 -0
- package/lib/Canvas/utils/Image/imageProperties.ts +207 -2
- package/lib/Canvas/utils/Patterns/enhancedPatternRenderer.ts +455 -444
- package/lib/Canvas/utils/Texts/enhancedTextRenderer.ts +274 -36
- package/lib/Canvas/utils/Texts/textPathRenderer.ts +320 -0
- package/lib/Canvas/utils/types.ts +173 -10
- package/lib/Canvas/utils/utils.ts +49 -2
- package/package.json +69 -34
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PathLike } from "fs";
|
|
2
|
-
import { OutputFormat, CanvasConfig, TextProperties, ImageProperties, GIFOptions, GIFResults, CustomOptions, cropOptions, Frame, ExtractFramesOptions, ResizeOptions, MaskOptions, BlendOptions } from "./utils/utils";
|
|
2
|
+
import { OutputFormat, CanvasConfig, TextProperties, ImageProperties, GIFOptions, GIFResults, CustomOptions, cropOptions, GradientConfig, Frame, ExtractFramesOptions, ResizeOptions, MaskOptions, BlendOptions, ImageFilter, BatchOperation, ChainOperation, StitchOptions, CollageLayout, CompressionOptions, PaletteOptions } from "./utils/utils";
|
|
3
3
|
interface CanvasResults {
|
|
4
4
|
buffer: Buffer;
|
|
5
5
|
canvas: CanvasConfig;
|
|
@@ -8,145 +8,21 @@ export declare class ApexPainter {
|
|
|
8
8
|
#private;
|
|
9
9
|
private format?;
|
|
10
10
|
constructor({ type }?: OutputFormat);
|
|
11
|
-
/**
|
|
12
|
-
* Creates a canvas with the given configuration.
|
|
13
|
-
* Applies rotation, shadow, border effects, background, and stroke.
|
|
14
|
-
*
|
|
15
|
-
* @param canvas - Canvas configuration object containing:
|
|
16
|
-
* - width: Canvas width in pixels
|
|
17
|
-
* - height: Canvas height in pixels
|
|
18
|
-
* - x: X position offset (default: 0)
|
|
19
|
-
* - y: Y position offset (default: 0)
|
|
20
|
-
* - colorBg: Solid color background (hex, rgb, rgba, hsl, etc.)
|
|
21
|
-
* - gradientBg: Gradient background configuration
|
|
22
|
-
* - customBg: Custom background image buffer
|
|
23
|
-
* - zoom: Canvas zoom level (default: 1)
|
|
24
|
-
* - pattern: Pattern background configuration
|
|
25
|
-
* - noise: Noise effect configuration
|
|
26
|
-
*
|
|
27
|
-
* @returns Promise<CanvasResults> - Object containing canvas buffer and configuration
|
|
28
|
-
*
|
|
29
|
-
* @throws Error if canvas configuration is invalid or conflicting
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const result = await painter.createCanvas({
|
|
34
|
-
* width: 800,
|
|
35
|
-
* height: 600,
|
|
36
|
-
* colorBg: '#ffffff',
|
|
37
|
-
* zoom: 1.5
|
|
38
|
-
* });
|
|
39
|
-
* const buffer = result.buffer;
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
11
|
createCanvas(canvas: CanvasConfig): Promise<CanvasResults>;
|
|
43
|
-
/**
|
|
44
|
-
* Draws one or more images (or shapes) on an existing canvas buffer.
|
|
45
|
-
*
|
|
46
|
-
* @param images - Single ImageProperties object or array of ImageProperties containing:
|
|
47
|
-
* - source: Image path/URL/Buffer or ShapeType ('rectangle', 'circle', etc.)
|
|
48
|
-
* - x: X position on canvas
|
|
49
|
-
* - y: Y position on canvas
|
|
50
|
-
* - width: Image/shape width (optional, defaults to original size)
|
|
51
|
-
* - height: Image/shape height (optional, defaults to original size)
|
|
52
|
-
* - inherit: Use original image dimensions (boolean)
|
|
53
|
-
* - fit: Image fitting mode ('fill', 'contain', 'cover', 'scale-down', 'none')
|
|
54
|
-
* - align: Image alignment ('center', 'start', 'end')
|
|
55
|
-
* - rotation: Rotation angle in degrees (default: 0)
|
|
56
|
-
* - opacity: Opacity level 0-1 (default: 1)
|
|
57
|
-
* - blur: Blur radius in pixels (default: 0)
|
|
58
|
-
* - borderRadius: Border radius or 'circular' (default: 0)
|
|
59
|
-
* - borderPosition: Border position ('all', 'top', 'bottom', 'left', 'right')
|
|
60
|
-
* - filters: Array of image filters to apply
|
|
61
|
-
* - shape: Shape properties (when source is a shape)
|
|
62
|
-
* - shadow: Shadow configuration
|
|
63
|
-
* - stroke: Stroke configuration
|
|
64
|
-
* - boxBackground: Background behind image/shape
|
|
65
|
-
*
|
|
66
|
-
* @param canvasBuffer - Existing canvas buffer (Buffer) or CanvasResults object
|
|
67
|
-
*
|
|
68
|
-
* @returns Promise<Buffer> - Updated canvas buffer in PNG format
|
|
69
|
-
*
|
|
70
|
-
* @throws Error if source, x, or y are missing
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* const result = await painter.createImage([
|
|
75
|
-
* {
|
|
76
|
-
* source: 'rectangle',
|
|
77
|
-
* x: 100, y: 100,
|
|
78
|
-
* width: 200, height: 150,
|
|
79
|
-
* shape: { fill: true, color: '#ff6b6b' },
|
|
80
|
-
* shadow: { color: 'rgba(0,0,0,0.3)', offsetX: 5, offsetY: 5, blur: 10 }
|
|
81
|
-
* }
|
|
82
|
-
* ], canvasBuffer);
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
12
|
createImage(images: ImageProperties | ImageProperties[], canvasBuffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
86
|
-
/**
|
|
87
|
-
* Creates text on an existing canvas buffer with enhanced styling options.
|
|
88
|
-
*
|
|
89
|
-
* @param textArray - Single TextProperties object or array of TextProperties containing:
|
|
90
|
-
* - text: Text content to render (required)
|
|
91
|
-
* - x: X position on canvas (required)
|
|
92
|
-
* - y: Y position on canvas (required)
|
|
93
|
-
* - fontPath: Path to custom font file (.ttf, .otf, .woff, etc.)
|
|
94
|
-
* - fontName: Custom font name (used with fontPath)
|
|
95
|
-
* - fontSize: Font size in pixels (default: 16)
|
|
96
|
-
* - fontFamily: Font family name (e.g., 'Arial', 'Helvetica')
|
|
97
|
-
* - bold: Make text bold (boolean)
|
|
98
|
-
* - italic: Make text italic (boolean)
|
|
99
|
-
* - underline: Add underline decoration (boolean)
|
|
100
|
-
* - overline: Add overline decoration (boolean)
|
|
101
|
-
* - strikethrough: Add strikethrough decoration (boolean)
|
|
102
|
-
* - highlight: Highlight text with background color and opacity
|
|
103
|
-
* - lineHeight: Line height multiplier (default: 1.4)
|
|
104
|
-
* - letterSpacing: Space between letters in pixels
|
|
105
|
-
* - wordSpacing: Space between words in pixels
|
|
106
|
-
* - maxWidth: Maximum width for text wrapping
|
|
107
|
-
* - maxHeight: Maximum height for text (truncates with ellipsis)
|
|
108
|
-
* - textAlign: Horizontal text alignment ('left', 'center', 'right', 'start', 'end')
|
|
109
|
-
* - textBaseline: Vertical text baseline ('alphabetic', 'bottom', 'hanging', 'ideographic', 'middle', 'top')
|
|
110
|
-
* - color: Text color (hex, rgb, rgba, hsl, etc.)
|
|
111
|
-
* - gradient: Gradient fill for text
|
|
112
|
-
* - opacity: Text opacity (0-1, default: 1)
|
|
113
|
-
* - glow: Text glow effect with color, intensity, and opacity
|
|
114
|
-
* - shadow: Text shadow effect with color, offset, blur, and opacity
|
|
115
|
-
* - stroke: Text stroke/outline with color, width, gradient, and opacity
|
|
116
|
-
* - rotation: Text rotation in degrees
|
|
117
|
-
*
|
|
118
|
-
* @param canvasBuffer - Existing canvas buffer (Buffer) or CanvasResults object
|
|
119
|
-
*
|
|
120
|
-
* @returns Promise<Buffer> - Updated canvas buffer in PNG format
|
|
121
|
-
*
|
|
122
|
-
* @throws Error if text, x, or y are missing, or if canvas buffer is invalid
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* const result = await painter.createText([
|
|
127
|
-
* {
|
|
128
|
-
* text: "Hello World!",
|
|
129
|
-
* x: 100, y: 100,
|
|
130
|
-
* fontSize: 24,
|
|
131
|
-
* bold: true,
|
|
132
|
-
* color: '#ff6b6b',
|
|
133
|
-
* shadow: { color: 'rgba(0,0,0,0.3)', offsetX: 2, offsetY: 2, blur: 4 },
|
|
134
|
-
* underline: true,
|
|
135
|
-
* highlight: { color: '#ffff00', opacity: 0.3 }
|
|
136
|
-
* }
|
|
137
|
-
* ], canvasBuffer);
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
13
|
createText(textArray: TextProperties | TextProperties[], canvasBuffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
141
|
-
createCustom(options: CustomOptions[], buffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
14
|
+
createCustom(options: CustomOptions | CustomOptions[], buffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
142
15
|
createGIF(gifFrames: {
|
|
143
16
|
background: string;
|
|
144
17
|
duration: number;
|
|
145
|
-
}[], options: GIFOptions): Promise<GIFResults |
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
18
|
+
}[], options: GIFOptions): Promise<GIFResults | Buffer | string | Array<{
|
|
19
|
+
attachment: NodeJS.ReadableStream | any;
|
|
20
|
+
name: string;
|
|
21
|
+
}> | undefined>;
|
|
22
|
+
resize(resizeOptions: ResizeOptions): Promise<Buffer>;
|
|
23
|
+
imgConverter(source: string, newExtension: string): Promise<Buffer>;
|
|
24
|
+
effects(source: string, filters: ImageFilter[]): Promise<Buffer>;
|
|
25
|
+
colorsFilter(source: string, filterColor: string | GradientConfig, opacity?: number): Promise<Buffer>;
|
|
150
26
|
colorAnalysis(source: string): Promise<{
|
|
151
27
|
color: string;
|
|
152
28
|
frequency: string;
|
|
@@ -155,24 +31,26 @@ export declare class ApexPainter {
|
|
|
155
31
|
red: number;
|
|
156
32
|
green: number;
|
|
157
33
|
blue: number;
|
|
158
|
-
}): Promise<Buffer
|
|
159
|
-
removeBackground(imageURL: string, apiKey: string): Promise<Buffer
|
|
160
|
-
blend(layers: {
|
|
34
|
+
}): Promise<Buffer | undefined>;
|
|
35
|
+
removeBackground(imageURL: string, apiKey: string): Promise<Buffer | undefined>;
|
|
36
|
+
blend(layers: Array<{
|
|
161
37
|
image: string | Buffer;
|
|
162
|
-
blendMode:
|
|
38
|
+
blendMode: GlobalCompositeOperation;
|
|
163
39
|
position?: {
|
|
164
40
|
x: number;
|
|
165
41
|
y: number;
|
|
166
42
|
};
|
|
167
43
|
opacity?: number;
|
|
168
|
-
}
|
|
169
|
-
createChart(data:
|
|
44
|
+
}>, baseImageBuffer: Buffer, defaultBlendMode?: GlobalCompositeOperation): Promise<Buffer>;
|
|
45
|
+
createChart(data: unknown, type: {
|
|
170
46
|
chartType: string;
|
|
171
47
|
chartNumber: number;
|
|
172
|
-
}): Promise<Buffer
|
|
48
|
+
}): Promise<Buffer>;
|
|
173
49
|
cropImage(options: cropOptions): Promise<Buffer>;
|
|
174
|
-
|
|
175
|
-
|
|
50
|
+
extractFrames(videoSource: string | Buffer, options: ExtractFramesOptions): Promise<Array<{
|
|
51
|
+
source: string;
|
|
52
|
+
isRemote: boolean;
|
|
53
|
+
}>>;
|
|
176
54
|
masking(source: string | Buffer | PathLike | Uint8Array, maskSource: string | Buffer | PathLike | Uint8Array, options?: MaskOptions): Promise<Buffer>;
|
|
177
55
|
gradientBlend(source: string | Buffer | PathLike | Uint8Array, options: BlendOptions): Promise<Buffer>;
|
|
178
56
|
animate(frames: Frame[], defaultDuration: number, defaultWidth?: number, defaultHeight?: number, options?: {
|
|
@@ -182,8 +60,81 @@ export declare class ApexPainter {
|
|
|
182
60
|
onFrame?: (index: number) => void;
|
|
183
61
|
onEnd?: () => void;
|
|
184
62
|
}): Promise<Buffer[] | undefined>;
|
|
185
|
-
|
|
186
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Processes multiple operations in parallel
|
|
65
|
+
* @param operations - Array of operations to process
|
|
66
|
+
* @returns Array of result buffers
|
|
67
|
+
*/
|
|
68
|
+
batch(operations: BatchOperation[]): Promise<Buffer[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Chains multiple operations sequentially
|
|
71
|
+
* @param operations - Array of operations to chain
|
|
72
|
+
* @returns Final result buffer
|
|
73
|
+
*/
|
|
74
|
+
chain(operations: ChainOperation[]): Promise<Buffer>;
|
|
75
|
+
/**
|
|
76
|
+
* Stitches multiple images together
|
|
77
|
+
* @param images - Array of image sources
|
|
78
|
+
* @param options - Stitching options
|
|
79
|
+
* @returns Stitched image buffer
|
|
80
|
+
*/
|
|
81
|
+
stitchImages(images: Array<string | Buffer>, options?: StitchOptions): Promise<Buffer>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates an image collage
|
|
84
|
+
* @param images - Array of image sources with optional dimensions
|
|
85
|
+
* @param layout - Collage layout configuration
|
|
86
|
+
* @returns Collage image buffer
|
|
87
|
+
*/
|
|
88
|
+
createCollage(images: Array<{
|
|
89
|
+
source: string | Buffer;
|
|
90
|
+
width?: number;
|
|
91
|
+
height?: number;
|
|
92
|
+
}>, layout: CollageLayout): Promise<Buffer>;
|
|
93
|
+
/**
|
|
94
|
+
* Compresses an image with quality control
|
|
95
|
+
* @param image - Image source (path, URL, or Buffer)
|
|
96
|
+
* @param options - Compression options
|
|
97
|
+
* @returns Compressed image buffer
|
|
98
|
+
*/
|
|
99
|
+
compress(image: string | Buffer, options?: CompressionOptions): Promise<Buffer>;
|
|
100
|
+
/**
|
|
101
|
+
* Extracts color palette from an image
|
|
102
|
+
* @param image - Image source (path, URL, or Buffer)
|
|
103
|
+
* @param options - Palette extraction options
|
|
104
|
+
* @returns Array of colors with percentages
|
|
105
|
+
*/
|
|
106
|
+
extractPalette(image: string | Buffer, options?: PaletteOptions): Promise<Array<{
|
|
107
|
+
color: string;
|
|
108
|
+
percentage: number;
|
|
109
|
+
}>>;
|
|
110
|
+
/**
|
|
111
|
+
* Validates a hexadecimal color string.
|
|
112
|
+
* @param hexColor - Hexadecimal color string to validate (format: #RRGGBB)
|
|
113
|
+
* @returns True if the color is valid
|
|
114
|
+
* @throws Error if the color format is invalid
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* painter.validHex('#ff0000'); // true
|
|
119
|
+
* painter.validHex('#FF00FF'); // true
|
|
120
|
+
* painter.validHex('invalid'); // throws Error
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
validHex(hexColor: string): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Converts results to the configured output format.
|
|
126
|
+
* @param results - Buffer or result to convert
|
|
127
|
+
* @returns Converted result in the configured format
|
|
128
|
+
* @throws Error if format is unsupported or conversion fails
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const painter = new ApexPainter({ type: 'base64' });
|
|
133
|
+
* const result = await painter.createCanvas({ width: 100, height: 100 });
|
|
134
|
+
* const base64String = await painter.outPut(result.buffer); // Returns base64 string
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
outPut(results: Buffer): Promise<Buffer | string | Blob | ArrayBuffer>;
|
|
187
138
|
}
|
|
188
139
|
export {};
|
|
189
140
|
//# sourceMappingURL=ApexPainter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApexPainter.d.ts","sourceRoot":"","sources":["../../../lib/Canvas/ApexPainter.ts"],"names":[],"mappings":"AAKA,OAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"ApexPainter.d.ts","sourceRoot":"","sources":["../../../lib/Canvas/ApexPainter.ts"],"names":[],"mappings":"AAKA,OAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAIpF,cAAc,EAAE,KAAK,EACrD,oBAAoB,EAAa,aAAa,EAAE,WAAW,EAAE,YAAY,EAIzE,WAAW,EASX,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAC/F,MAAM,eAAe,CAAC;AAIzB,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;CACtB;AAGH,qBAAa,WAAW;;IACtB,OAAO,CAAC,MAAM,CAAC,CAAe;gBAElB,EAAE,IAAI,EAAE,GAAE,YAAiC;IAmGjD,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAmN1D,WAAW,CACf,MAAM,EAAE,eAAe,GAAG,eAAe,EAAE,EAC3C,YAAY,EAAE,aAAa,GAAG,MAAM,GACnC,OAAO,CAAC,MAAM,CAAC;IAyiBZ,UAAU,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,EAAE,EAAE,YAAY,EAAE,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuE/G,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,aAA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