apexify.js 4.5.30 → 4.5.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/ApexPainter.d.ts +94 -7
- package/dist/canvas/ApexPainter.d.ts.map +1 -1
- package/dist/canvas/ApexPainter.js +443 -119
- package/dist/canvas/ApexPainter.js.map +1 -1
- package/dist/canvas/utils/bg.d.ts +3 -3
- package/dist/canvas/utils/bg.d.ts.map +1 -1
- package/dist/canvas/utils/bg.js +35 -15
- package/dist/canvas/utils/bg.js.map +1 -1
- package/dist/canvas/utils/customLines.d.ts +2 -1
- package/dist/canvas/utils/customLines.d.ts.map +1 -1
- package/dist/canvas/utils/customLines.js +67 -31
- package/dist/canvas/utils/customLines.js.map +1 -1
- package/dist/canvas/utils/general functions.d.ts +2 -2
- package/dist/canvas/utils/general functions.d.ts.map +1 -1
- package/dist/canvas/utils/general functions.js +52 -15
- package/dist/canvas/utils/general functions.js.map +1 -1
- package/dist/canvas/utils/types.d.ts +68 -0
- package/dist/canvas/utils/types.d.ts.map +1 -1
- package/dist/canvas/utils/types.js +2 -4
- package/dist/canvas/utils/types.js.map +1 -1
- package/dist/canvas/utils/utils.d.ts +2 -2
- package/dist/canvas/utils/utils.d.ts.map +1 -1
- package/examples/barchart.txt +71 -0
- package/examples/linechart.txt +93 -0
- package/examples/piechart.txt +67 -0
- package/lib/canvas/ApexPainter.ts +665 -262
- package/lib/canvas/utils/bg.ts +42 -16
- package/lib/canvas/utils/customLines.ts +88 -43
- package/lib/canvas/utils/general functions.ts +98 -41
- package/lib/canvas/utils/types.ts +77 -1
- package/lib/canvas/utils/utils.ts +6 -2
- package/package.json +19 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutputFormat, CanvasConfig, TextObject, ImageProperties, ImageObject, GIFOptions, GIFResults, CustomOptions, cropOptions } from "./utils/utils";
|
|
1
|
+
import { OutputFormat, CanvasConfig, TextObject, ImageProperties, ImageObject, GIFOptions, GIFResults, CustomOptions, cropOptions, GradientConfig, Frame, PatternOptions, ExtractFramesOptions } from "./utils/utils";
|
|
2
2
|
interface CanvasResults {
|
|
3
3
|
buffer: Buffer;
|
|
4
4
|
canvas: CanvasConfig;
|
|
@@ -7,20 +7,23 @@ export declare class ApexPainter {
|
|
|
7
7
|
private format?;
|
|
8
8
|
constructor({ type }?: OutputFormat);
|
|
9
9
|
createCanvas(canvas: CanvasConfig): Promise<CanvasResults>;
|
|
10
|
-
createImage(images: ImageProperties[], canvasBuffer: CanvasResults): Promise<Buffer>;
|
|
11
|
-
createText(textOptionsArray: TextObject[], buffer: CanvasResults): Promise<Buffer>;
|
|
12
|
-
createCustom(
|
|
13
|
-
createGIF(
|
|
10
|
+
createImage(images: ImageProperties[], canvasBuffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
11
|
+
createText(textOptionsArray: TextObject[], buffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
12
|
+
createCustom(options: CustomOptions[], buffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
13
|
+
createGIF(gifFrames: {
|
|
14
|
+
background: string;
|
|
15
|
+
duration: number;
|
|
16
|
+
}[], options: GIFOptions): Promise<GIFResults | any>;
|
|
14
17
|
resize(resizeOptions: {
|
|
15
18
|
imagePath: string | Buffer;
|
|
16
19
|
size: {
|
|
17
20
|
width: number;
|
|
18
21
|
height: number;
|
|
19
22
|
};
|
|
20
|
-
}): Promise<
|
|
23
|
+
}): Promise<Buffer>;
|
|
21
24
|
imgConverter(imagePath: string, newExtension: string): Promise<Buffer>;
|
|
22
25
|
processImage(imagePath: string, filters: any[]): Promise<Buffer>;
|
|
23
|
-
colorsFilter(imagePath: string, filterColor:
|
|
26
|
+
colorsFilter(imagePath: string, filterColor: any, opacity?: number): Promise<any>;
|
|
24
27
|
colorAnalysis(imagePath: string): Promise<{
|
|
25
28
|
color: string;
|
|
26
29
|
frequency: string;
|
|
@@ -31,12 +34,96 @@ export declare class ApexPainter {
|
|
|
31
34
|
blue: number;
|
|
32
35
|
}): Promise<Buffer | undefined>;
|
|
33
36
|
removeBackground(imageURL: string, apiKey: string): Promise<Buffer | undefined>;
|
|
37
|
+
blend(layers: {
|
|
38
|
+
image: string | Buffer;
|
|
39
|
+
blendMode: 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'lighter' | 'copy' | 'xor' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
|
|
40
|
+
position?: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
opacity?: number;
|
|
45
|
+
}[], baseImageBuffer: Buffer): Promise<Buffer>;
|
|
34
46
|
createChart(data: any, type: {
|
|
35
47
|
chartType: string;
|
|
36
48
|
chartNumber: number;
|
|
37
49
|
}): Promise<Buffer | undefined>;
|
|
38
50
|
cropImage(options: cropOptions): Promise<Buffer>;
|
|
39
51
|
private drawImage;
|
|
52
|
+
extractFrames(videoSource: string | Buffer, options: ExtractFramesOptions): Promise<ImageObject[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Sets a pattern on a specific area of a buffered image.
|
|
55
|
+
* @param {Buffer} buffer - The source image buffer.
|
|
56
|
+
* @param {Object} options - Options to customize the pattern.
|
|
57
|
+
* @returns {Promise<Buffer>} - The adjusted image buffer.
|
|
58
|
+
*/
|
|
59
|
+
setPatternBackground(buffer: Buffer, options: PatternOptions): Promise<Buffer>;
|
|
60
|
+
/**
|
|
61
|
+
* Fills the specified area with a gradient.
|
|
62
|
+
* @param ctx The rendering context of the canvas.
|
|
63
|
+
* @param width The width of the area to fill.
|
|
64
|
+
* @param height The height of the area to fill.
|
|
65
|
+
* @param gradient The gradient options.
|
|
66
|
+
* @param x The x offset of the area.
|
|
67
|
+
* @param y The y offset of the area.
|
|
68
|
+
*/
|
|
69
|
+
fillWithGradient(ctx: any, width: number, height: number, gradient: GradientConfig, x?: number, y?: number): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Draws a dots pattern in the specified area.
|
|
72
|
+
* @param ctx The rendering context of the canvas.
|
|
73
|
+
* @param width The width of the area.
|
|
74
|
+
* @param height The height of the area.
|
|
75
|
+
* @param options Options to customize the dot pattern.
|
|
76
|
+
* @param x The x offset of the area.
|
|
77
|
+
* @param y The y offset of the area.
|
|
78
|
+
*/
|
|
79
|
+
drawDotsPattern(ctx: any, width: number, height: number, options: PatternOptions, x?: number, y?: number): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Draws a stripes pattern in the specified area.
|
|
82
|
+
* @param ctx The rendering context of the canvas.
|
|
83
|
+
* @param width The width of the area.
|
|
84
|
+
* @param height The height of the area.
|
|
85
|
+
* @param options Options to customize the stripes pattern.
|
|
86
|
+
* @param x The x offset of the area.
|
|
87
|
+
* @param y The y offset of the area.
|
|
88
|
+
*/
|
|
89
|
+
drawStripesPattern(ctx: any, width: number, height: number, options: PatternOptions, x?: number, y?: number): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Draws a grid pattern in the specified area.
|
|
92
|
+
* @param ctx The rendering context of the canvas.
|
|
93
|
+
* @param width The width of the area.
|
|
94
|
+
* @param height The height of the area.
|
|
95
|
+
* @param options Options to customize the grid pattern.
|
|
96
|
+
* @param x The x offset of the area.
|
|
97
|
+
* @param y The y offset of the area.
|
|
98
|
+
*/
|
|
99
|
+
drawGridPattern(ctx: any, width: number, height: number, options: PatternOptions, x?: number, y?: number): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Draws a checkerboard pattern in the specified area.
|
|
102
|
+
* @param ctx The rendering context of the canvas.
|
|
103
|
+
* @param width The width of the area.
|
|
104
|
+
* @param height The height of the area.
|
|
105
|
+
* @param options Options to customize the checkerboard pattern.
|
|
106
|
+
* @param x The x offset of the area.
|
|
107
|
+
* @param y The y offset of the area.
|
|
108
|
+
*/
|
|
109
|
+
drawCheckerboardPattern(ctx: any, width: number, height: number, options: PatternOptions, x?: number, y?: number): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Draws a custom image pattern in the specified area.
|
|
112
|
+
* @param ctx The rendering context of the canvas.
|
|
113
|
+
* @param width The width of the area.
|
|
114
|
+
* @param height The height of the area.
|
|
115
|
+
* @param options Options to customize the custom pattern.
|
|
116
|
+
* @param x The x offset of the area.
|
|
117
|
+
* @param y The y offset of the area.
|
|
118
|
+
*/
|
|
119
|
+
drawCustomPattern(ctx: any, width: number, height: number, options: PatternOptions, x?: number, y?: number): Promise<void>;
|
|
120
|
+
animate(frames: Frame[], defaultDuration: number, defaultWidth?: number, defaultHeight?: number, options?: {
|
|
121
|
+
gif?: boolean;
|
|
122
|
+
gifPath?: string;
|
|
123
|
+
onStart?: () => void;
|
|
124
|
+
onFrame?: (index: number) => void;
|
|
125
|
+
onEnd?: () => void;
|
|
126
|
+
}): Promise<Buffer[] | undefined>;
|
|
40
127
|
validHex(hexColor: string): any;
|
|
41
128
|
outPut(results: any): Promise<void | Buffer | string | Blob | Object | HTMLCanvasElement>;
|
|
42
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApexPainter.d.ts","sourceRoot":"","sources":["../../lib/canvas/ApexPainter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApexPainter.d.ts","sourceRoot":"","sources":["../../lib/canvas/ApexPainter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAGZ,cAAc,EAAE,KAAK,EACrI,cAAc,EAAE,oBAAoB,EACpC,MAAM,eAAe,CAAC;AAEzB,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;CACtB;AAEH,qBAAa,WAAW;IACt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