apexify.js 4.6.1 → 4.6.3
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/cjs/ai/functions/readFiles.js +1 -1
- package/dist/cjs/ai/functions/readFiles.js.map +1 -1
- package/dist/cjs/ai/modals-chat/electronHub/chatmodels.d.ts.map +1 -1
- package/dist/cjs/ai/modals-chat/electronHub/chatmodels.js +2 -1
- package/dist/cjs/ai/modals-chat/electronHub/chatmodels.js.map +1 -1
- package/dist/cjs/ai/modals-chat/electronHub/speechModels.d.ts.map +1 -1
- package/dist/cjs/ai/modals-chat/electronHub/speechModels.js +1 -1
- package/dist/cjs/ai/modals-chat/electronHub/speechModels.js.map +1 -1
- package/dist/cjs/canvas/ApexPainter.d.ts.map +1 -1
- package/dist/cjs/canvas/ApexPainter.js +27 -28
- package/dist/cjs/canvas/ApexPainter.js.map +1 -1
- package/dist/cjs/canvas/Themes/Level-Up/levelup.d.ts +11 -0
- package/dist/cjs/canvas/Themes/Level-Up/levelup.d.ts.map +1 -0
- package/dist/cjs/canvas/Themes/Level-Up/levelup.js +163 -0
- package/dist/cjs/canvas/Themes/Level-Up/levelup.js.map +1 -0
- package/dist/cjs/canvas/utils/Background/bg.d.ts +17 -10
- package/dist/cjs/canvas/utils/Background/bg.d.ts.map +1 -1
- package/dist/cjs/canvas/utils/Background/bg.js +102 -27
- package/dist/cjs/canvas/utils/Background/bg.js.map +1 -1
- package/dist/cjs/canvas/utils/Custom/customLines.d.ts.map +1 -1
- package/dist/cjs/canvas/utils/Custom/customLines.js +43 -19
- package/dist/cjs/canvas/utils/Custom/customLines.js.map +1 -1
- package/dist/cjs/canvas/utils/General/general functions.d.ts +6 -1
- package/dist/cjs/canvas/utils/General/general functions.d.ts.map +1 -1
- package/dist/cjs/canvas/utils/General/general functions.js +19 -20
- package/dist/cjs/canvas/utils/General/general functions.js.map +1 -1
- package/dist/cjs/canvas/utils/Image/imageProperties.d.ts +3 -9
- package/dist/cjs/canvas/utils/Image/imageProperties.d.ts.map +1 -1
- package/dist/cjs/canvas/utils/Image/imageProperties.js +221 -215
- package/dist/cjs/canvas/utils/Image/imageProperties.js.map +1 -1
- package/dist/cjs/canvas/utils/Texts/textProperties.d.ts +12 -14
- package/dist/cjs/canvas/utils/Texts/textProperties.d.ts.map +1 -1
- package/dist/cjs/canvas/utils/Texts/textProperties.js +100 -91
- package/dist/cjs/canvas/utils/Texts/textProperties.js.map +1 -1
- package/dist/cjs/canvas/utils/types.d.ts +89 -109
- 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 +2 -4
- package/dist/cjs/canvas/utils/utils.d.ts.map +1 -1
- package/dist/cjs/canvas/utils/utils.js +2 -5
- package/dist/cjs/canvas/utils/utils.js.map +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +31 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/ai/functions/readFiles.js +1 -1
- package/dist/esm/ai/functions/readFiles.js.map +1 -1
- package/dist/esm/ai/modals-chat/electronHub/chatmodels.d.ts.map +1 -1
- package/dist/esm/ai/modals-chat/electronHub/chatmodels.js +2 -1
- package/dist/esm/ai/modals-chat/electronHub/chatmodels.js.map +1 -1
- package/dist/esm/ai/modals-chat/electronHub/speechModels.d.ts.map +1 -1
- package/dist/esm/ai/modals-chat/electronHub/speechModels.js +1 -1
- package/dist/esm/ai/modals-chat/electronHub/speechModels.js.map +1 -1
- package/dist/esm/canvas/ApexPainter.d.ts.map +1 -1
- package/dist/esm/canvas/ApexPainter.js +27 -28
- package/dist/esm/canvas/ApexPainter.js.map +1 -1
- package/dist/esm/canvas/Themes/Level-Up/levelup.d.ts +11 -0
- package/dist/esm/canvas/Themes/Level-Up/levelup.d.ts.map +1 -0
- package/dist/esm/canvas/Themes/Level-Up/levelup.js +163 -0
- package/dist/esm/canvas/Themes/Level-Up/levelup.js.map +1 -0
- package/dist/esm/canvas/utils/Background/bg.d.ts +17 -10
- package/dist/esm/canvas/utils/Background/bg.d.ts.map +1 -1
- package/dist/esm/canvas/utils/Background/bg.js +102 -27
- package/dist/esm/canvas/utils/Background/bg.js.map +1 -1
- package/dist/esm/canvas/utils/Custom/customLines.d.ts.map +1 -1
- package/dist/esm/canvas/utils/Custom/customLines.js +43 -19
- package/dist/esm/canvas/utils/Custom/customLines.js.map +1 -1
- package/dist/esm/canvas/utils/General/general functions.d.ts +6 -1
- package/dist/esm/canvas/utils/General/general functions.d.ts.map +1 -1
- package/dist/esm/canvas/utils/General/general functions.js +19 -20
- package/dist/esm/canvas/utils/General/general functions.js.map +1 -1
- package/dist/esm/canvas/utils/Image/imageProperties.d.ts +3 -9
- package/dist/esm/canvas/utils/Image/imageProperties.d.ts.map +1 -1
- package/dist/esm/canvas/utils/Image/imageProperties.js +221 -215
- package/dist/esm/canvas/utils/Image/imageProperties.js.map +1 -1
- package/dist/esm/canvas/utils/Texts/textProperties.d.ts +12 -14
- package/dist/esm/canvas/utils/Texts/textProperties.d.ts.map +1 -1
- package/dist/esm/canvas/utils/Texts/textProperties.js +100 -91
- package/dist/esm/canvas/utils/Texts/textProperties.js.map +1 -1
- package/dist/esm/canvas/utils/types.d.ts +89 -109
- 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 +2 -4
- package/dist/esm/canvas/utils/utils.d.ts.map +1 -1
- package/dist/esm/canvas/utils/utils.js +2 -5
- package/dist/esm/canvas/utils/utils.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +31 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/ai/functions/readFiles.ts +1 -1
- package/lib/ai/modals-chat/electronHub/chatmodels.ts +4 -2
- package/lib/ai/modals-chat/electronHub/speechModels.ts +2 -1
- package/lib/canvas/ApexPainter.ts +52 -61
- package/lib/canvas/Themes/Level-Up/levelup.ts +183 -0
- package/lib/canvas/utils/Background/bg.ts +179 -65
- package/lib/canvas/utils/Custom/customLines.ts +53 -20
- package/lib/canvas/utils/General/general functions.ts +21 -29
- package/lib/canvas/utils/Image/imageProperties.ts +399 -318
- package/lib/canvas/utils/Texts/textProperties.ts +213 -162
- package/lib/canvas/utils/types.ts +74 -107
- package/lib/canvas/utils/utils.ts +2 -5
- package/lib/index.ts +38 -10
- package/package.json +2 -2
- package/dist/cjs/canvas/utils/Background/circular.d.ts +0 -3
- package/dist/cjs/canvas/utils/Background/circular.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/Background/circular.js +0 -13
- package/dist/cjs/canvas/utils/Background/circular.js.map +0 -1
- package/dist/cjs/canvas/utils/Background/radius.d.ts +0 -18
- package/dist/cjs/canvas/utils/Background/radius.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/Background/radius.js +0 -104
- package/dist/cjs/canvas/utils/Background/radius.js.map +0 -1
- package/dist/esm/canvas/utils/Background/circular.d.ts +0 -3
- package/dist/esm/canvas/utils/Background/circular.d.ts.map +0 -1
- package/dist/esm/canvas/utils/Background/circular.js +0 -13
- package/dist/esm/canvas/utils/Background/circular.js.map +0 -1
- package/dist/esm/canvas/utils/Background/radius.d.ts +0 -18
- package/dist/esm/canvas/utils/Background/radius.d.ts.map +0 -1
- package/dist/esm/canvas/utils/Background/radius.js +0 -104
- package/dist/esm/canvas/utils/Background/radius.js.map +0 -1
- package/lib/canvas/utils/Background/circular.ts +0 -17
- package/lib/canvas/utils/Background/radius.ts +0 -102
|
@@ -22,8 +22,7 @@ export declare function applyZoom(ctx: SKRSContext2D, zoom?: {
|
|
|
22
22
|
}): void;
|
|
23
23
|
/**
|
|
24
24
|
* Applies stroke to the canvas context with support for selective side strokes.
|
|
25
|
-
*
|
|
26
|
-
* Otherwise, it constructs individual segments for the specified sides.
|
|
25
|
+
* Supports optional blur effect on the stroke.
|
|
27
26
|
*
|
|
28
27
|
* @param ctx The canvas rendering context.
|
|
29
28
|
* @param stroke The stroke properties.
|
|
@@ -31,14 +30,9 @@ export declare function applyZoom(ctx: SKRSContext2D, zoom?: {
|
|
|
31
30
|
* @param y The y-coordinate of the shape.
|
|
32
31
|
* @param width The width of the shape.
|
|
33
32
|
* @param height The height of the shape.
|
|
33
|
+
* @param blur Optional blur effect on the stroke.
|
|
34
34
|
*/
|
|
35
|
-
export declare function applyStroke(ctx: SKRSContext2D, stroke: ImageProperties[
|
|
36
|
-
/**
|
|
37
|
-
* Draws a shape on the canvas context based on the provided settings.
|
|
38
|
-
* Supports built‑in shapes as well as a custom polygon.
|
|
39
|
-
* @param ctx - The canvas rendering context.
|
|
40
|
-
* @param shapeSettings - The settings for the shape.
|
|
41
|
-
*/
|
|
35
|
+
export declare function applyStroke(ctx: SKRSContext2D, stroke: ImageProperties["stroke"], x: number, y: number, width: number, height: number, shapeName?: string, isImage?: boolean): void;
|
|
42
36
|
export declare function drawShape(ctx: SKRSContext2D, shapeSettings: any): void;
|
|
43
37
|
export declare function createGradient(ctx: any, gradientOptions: any, startX: number, startY: number, endX: number, endY: number): any;
|
|
44
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageProperties.d.ts","sourceRoot":"","sources":["../../../../../lib/canvas/utils/Image/imageProperties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACvB,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,EACjC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,IAAI,
|
|
1
|
+
{"version":3,"file":"imageProperties.d.ts","sourceRoot":"","sources":["../../../../../lib/canvas/utils/Image/imageProperties.ts"],"names":[],"mappings":"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"}
|
|
@@ -25,9 +25,9 @@ function applyShadow(ctx, shadow, x, y, width, height) {
|
|
|
25
25
|
ctx.filter = `blur(${shadow.blur ?? 0}px)`;
|
|
26
26
|
const shadowX = x + (shadow.offsetX ?? 0);
|
|
27
27
|
const shadowY = y + (shadow.offsetY ?? 0);
|
|
28
|
-
objectRadius(ctx, shadowX, shadowY, width, height, shadow.borderRadius ?? 2
|
|
28
|
+
objectRadius(ctx, shadowX, shadowY, width, height, shadow.borderRadius ?? 2);
|
|
29
29
|
ctx.fillStyle = shadow.gradient
|
|
30
|
-
? createGradient(ctx, shadow.gradient,
|
|
30
|
+
? createGradient(ctx, shadow.gradient, shadowX, shadowY, shadowX + width, shadowY + height)
|
|
31
31
|
: shadow.color || "transparent";
|
|
32
32
|
ctx.fill();
|
|
33
33
|
}
|
|
@@ -52,8 +52,7 @@ function applyZoom(ctx, zoom) {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Applies stroke to the canvas context with support for selective side strokes.
|
|
55
|
-
*
|
|
56
|
-
* Otherwise, it constructs individual segments for the specified sides.
|
|
55
|
+
* Supports optional blur effect on the stroke.
|
|
57
56
|
*
|
|
58
57
|
* @param ctx The canvas rendering context.
|
|
59
58
|
* @param stroke The stroke properties.
|
|
@@ -61,38 +60,79 @@ function applyZoom(ctx, zoom) {
|
|
|
61
60
|
* @param y The y-coordinate of the shape.
|
|
62
61
|
* @param width The width of the shape.
|
|
63
62
|
* @param height The height of the shape.
|
|
63
|
+
* @param blur Optional blur effect on the stroke.
|
|
64
64
|
*/
|
|
65
|
-
function applyStroke(ctx, stroke, x, y, width, height) {
|
|
65
|
+
function applyStroke(ctx, stroke, x, y, width, height, shapeName, isImage) {
|
|
66
66
|
if (!stroke)
|
|
67
67
|
return;
|
|
68
68
|
ctx.save();
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
if (stroke.blur && stroke.blur > 0) {
|
|
70
|
+
ctx.filter = `blur(${stroke.blur}px)`;
|
|
71
|
+
}
|
|
72
|
+
ctx.strokeStyle = stroke.gradient
|
|
71
73
|
? createGradient(ctx, stroke.gradient, x, y, x + width, y + height)
|
|
72
74
|
: stroke.color || "transparent";
|
|
73
75
|
ctx.lineWidth = stroke.width && stroke.width > 0 ? stroke.width : 2;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
ctx.beginPath();
|
|
77
|
+
if (isImage) {
|
|
78
|
+
ctx.globalCompositeOperation = "source-atop";
|
|
79
|
+
ctx.rect(x, y, width, height);
|
|
80
|
+
}
|
|
81
|
+
else if (["heart", "arrow", "circle", "star", "pentagon", "hexagon", "heptagon", "octagon", "diamond", "trapezoid", "kite"].includes(shapeName)) {
|
|
82
|
+
switch (shapeName) {
|
|
83
|
+
case "circle":
|
|
84
|
+
ctx.arc(x + width / 2, y + height / 2, width / 2, 0, Math.PI * 2);
|
|
85
|
+
break;
|
|
86
|
+
case "star":
|
|
87
|
+
drawStar(ctx, x, y, width, height);
|
|
88
|
+
break;
|
|
89
|
+
case "arrow":
|
|
90
|
+
drawArrow(ctx, x, y, width, height);
|
|
91
|
+
break;
|
|
92
|
+
case "pentagon":
|
|
93
|
+
case "hexagon":
|
|
94
|
+
case "heptagon":
|
|
95
|
+
case "octagon":
|
|
96
|
+
const sides = parseInt(shapeName.replace(/\D/g, ""), 10);
|
|
97
|
+
drawPolygon(ctx, x, y, width, height, sides);
|
|
98
|
+
break;
|
|
99
|
+
case "diamond":
|
|
100
|
+
ctx.moveTo(x + width / 2, y);
|
|
101
|
+
ctx.lineTo(x + width, y + height / 2);
|
|
102
|
+
ctx.lineTo(x + width / 2, y + height);
|
|
103
|
+
ctx.lineTo(x, y + height / 2);
|
|
104
|
+
ctx.closePath();
|
|
105
|
+
break;
|
|
106
|
+
case "trapezoid":
|
|
107
|
+
const topWidth = width * 0.6;
|
|
108
|
+
const offset = (width - topWidth) / 2;
|
|
109
|
+
ctx.moveTo(x + offset, y);
|
|
110
|
+
ctx.lineTo(x + offset + topWidth, y);
|
|
111
|
+
ctx.lineTo(x + width, y + height);
|
|
112
|
+
ctx.lineTo(x, y + height);
|
|
113
|
+
ctx.closePath();
|
|
114
|
+
break;
|
|
115
|
+
case "heart":
|
|
116
|
+
drawHeart(ctx, x, y, width, height);
|
|
117
|
+
break;
|
|
118
|
+
case "kite":
|
|
119
|
+
ctx.moveTo(x + width / 2, y);
|
|
120
|
+
ctx.lineTo(x + width, y + height / 2);
|
|
121
|
+
ctx.lineTo(x + width / 2, y + height);
|
|
122
|
+
ctx.lineTo(x, y + height / 2);
|
|
123
|
+
ctx.closePath();
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
objectRadius(ctx, x, y, width, height, stroke.borderRadius || 2, "all");
|
|
129
|
+
}
|
|
85
130
|
ctx.stroke();
|
|
131
|
+
ctx.filter = "none";
|
|
86
132
|
ctx.restore();
|
|
87
133
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Draws a shape on the canvas context based on the provided settings.
|
|
90
|
-
* Supports built‑in shapes as well as a custom polygon.
|
|
91
|
-
* @param ctx - The canvas rendering context.
|
|
92
|
-
* @param shapeSettings - The settings for the shape.
|
|
93
|
-
*/
|
|
94
134
|
function drawShape(ctx, shapeSettings) {
|
|
95
|
-
const { source, x, y, width, height, rotation = 0, borderRadius = 0, borderPosition = 'all', stroke, shadow, isFilled = false, color = "transparent", gradient, } = shapeSettings;
|
|
135
|
+
const { source, x, y, width, height, rotation = 0, borderRadius = 0, borderPosition = 'all', stroke, shadow, isFilled = false, color = "transparent", gradient, filling, } = shapeSettings;
|
|
96
136
|
const shapeName = source.toLowerCase();
|
|
97
137
|
ctx.save();
|
|
98
138
|
applyRotation(ctx, rotation, x, y, width, height);
|
|
@@ -114,41 +154,16 @@ function drawShape(ctx, shapeSettings) {
|
|
|
114
154
|
ctx.closePath();
|
|
115
155
|
break;
|
|
116
156
|
}
|
|
117
|
-
case 'pentagon':
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
case 'hexagon': {
|
|
122
|
-
drawPolygon(ctx, x, y, width, height, 6);
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
case 'heptagon': {
|
|
126
|
-
drawPolygon(ctx, x, y, width, height, 7);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
157
|
+
case 'pentagon':
|
|
158
|
+
case 'hexagon':
|
|
159
|
+
case 'heptagon':
|
|
129
160
|
case 'octagon': {
|
|
130
|
-
|
|
161
|
+
const sides = parseInt(shapeName.replace(/\D/g, ""), 10);
|
|
162
|
+
drawPolygon(ctx, x, y, width, height, sides);
|
|
131
163
|
break;
|
|
132
164
|
}
|
|
133
165
|
case 'star': {
|
|
134
|
-
|
|
135
|
-
const cx = x + width / 2;
|
|
136
|
-
const cy = y + height / 2;
|
|
137
|
-
const outerRadius = Math.min(width, height) / 2;
|
|
138
|
-
const innerRadius = outerRadius / 2;
|
|
139
|
-
const step = Math.PI / 5;
|
|
140
|
-
for (let i = 0; i < 10; i++) {
|
|
141
|
-
const r = i % 2 === 0 ? outerRadius : innerRadius;
|
|
142
|
-
const angle = i * step - Math.PI / 2;
|
|
143
|
-
if (i === 0) {
|
|
144
|
-
ctx.moveTo(cx + r * Math.cos(angle), cy + r * Math.sin(angle));
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
ctx.lineTo(cx + r * Math.cos(angle), cy + r * Math.sin(angle));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
ctx.closePath();
|
|
151
|
-
}
|
|
166
|
+
drawStar(ctx, x, y, width, height);
|
|
152
167
|
break;
|
|
153
168
|
}
|
|
154
169
|
case 'kite': {
|
|
@@ -163,23 +178,12 @@ function drawShape(ctx, shapeSettings) {
|
|
|
163
178
|
ctx.ellipse(x + width / 2, y + height / 2, width / 2, height / 2, 0, 0, Math.PI * 2);
|
|
164
179
|
break;
|
|
165
180
|
}
|
|
166
|
-
case '
|
|
167
|
-
ctx
|
|
168
|
-
ctx.bezierCurveTo(x + width * 0.1, y + height * 0.5, x, y + height * 0.2, x + width / 2, y + height * 0.3);
|
|
169
|
-
ctx.bezierCurveTo(x + width, y + height * 0.2, x + width * 0.9, y + height * 0.5, x + width / 2, y + height * 0.75);
|
|
170
|
-
ctx.closePath();
|
|
181
|
+
case 'arrow': {
|
|
182
|
+
drawArrow(ctx, x, y, width, height);
|
|
171
183
|
break;
|
|
172
184
|
}
|
|
173
|
-
case '
|
|
174
|
-
|
|
175
|
-
ctx.moveTo(x, y + height / 2);
|
|
176
|
-
ctx.lineTo(x + width - arrowHeadWidth, y + height / 2);
|
|
177
|
-
ctx.lineTo(x + width - arrowHeadWidth, y);
|
|
178
|
-
ctx.lineTo(x + width, y + height / 2);
|
|
179
|
-
ctx.lineTo(x + width - arrowHeadWidth, y + height);
|
|
180
|
-
ctx.lineTo(x + width - arrowHeadWidth, y + height / 2);
|
|
181
|
-
ctx.lineTo(x, y + height / 2);
|
|
182
|
-
ctx.closePath();
|
|
185
|
+
case 'heart': {
|
|
186
|
+
drawHeart(ctx, x, y, width, height);
|
|
183
187
|
break;
|
|
184
188
|
}
|
|
185
189
|
case 'diamond': {
|
|
@@ -200,17 +204,6 @@ function drawShape(ctx, shapeSettings) {
|
|
|
200
204
|
ctx.closePath();
|
|
201
205
|
break;
|
|
202
206
|
}
|
|
203
|
-
case 'cloud': {
|
|
204
|
-
const radius = width / 5;
|
|
205
|
-
ctx.moveTo(x + radius, y + height / 2);
|
|
206
|
-
ctx.arc(x + radius, y + height / 2, radius, Math.PI * 0.5, Math.PI * 1.5);
|
|
207
|
-
ctx.arc(x + width / 2, y + height / 2 - radius, radius, Math.PI, 0);
|
|
208
|
-
ctx.arc(x + width - radius, y + height / 2, radius, Math.PI * 1.5, Math.PI * 0.5);
|
|
209
|
-
ctx.lineTo(x + width, y + height);
|
|
210
|
-
ctx.lineTo(x, y + height);
|
|
211
|
-
ctx.closePath();
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
207
|
default: {
|
|
215
208
|
ctx.restore();
|
|
216
209
|
throw new Error(`Unsupported shape: ${shapeName}`);
|
|
@@ -220,42 +213,104 @@ function drawShape(ctx, shapeSettings) {
|
|
|
220
213
|
if (borderRadius && shapeName !== 'circle' && shapeName !== 'oval') {
|
|
221
214
|
objectRadius(ctx, x, y, width, height, borderRadius, borderPosition);
|
|
222
215
|
}
|
|
216
|
+
let fillStyle = color;
|
|
223
217
|
if (gradient) {
|
|
224
|
-
|
|
225
|
-
|
|
218
|
+
fillStyle = createGradient(ctx, gradient, x, y, x + width, y + height);
|
|
219
|
+
}
|
|
220
|
+
if (filling && filling.percentage <= 100) {
|
|
221
|
+
ctx.save();
|
|
222
|
+
const isCustomShape = ["heart", "arrow", "star", "pentagon", "hexagon", "heptagon", "octagon", "diamond", "trapezoid", "kite", "oval", "circle"].includes(shapeName);
|
|
223
|
+
if (isCustomShape) {
|
|
224
|
+
ctx.clip();
|
|
225
|
+
}
|
|
226
|
+
let fillX = x;
|
|
227
|
+
let fillY = y;
|
|
228
|
+
let fillWidth = width;
|
|
229
|
+
let fillHeight = height;
|
|
230
|
+
switch (filling.rotation) {
|
|
231
|
+
case 0:
|
|
232
|
+
fillHeight = (filling.percentage / 100) * height;
|
|
233
|
+
fillY = y + height - fillHeight;
|
|
234
|
+
break;
|
|
235
|
+
case 180:
|
|
236
|
+
fillHeight = (filling.percentage / 100) * height;
|
|
237
|
+
break;
|
|
238
|
+
case 90:
|
|
239
|
+
fillWidth = (filling.percentage / 100) * width;
|
|
240
|
+
break;
|
|
241
|
+
case 270:
|
|
242
|
+
fillWidth = (filling.percentage / 100) * width;
|
|
243
|
+
fillX = x + width - fillWidth;
|
|
244
|
+
break;
|
|
245
|
+
default:
|
|
246
|
+
console.warn(`Unsupported filling rotation: ${filling.rotation}, defaulting to 0 (Bottom to Top).`);
|
|
247
|
+
fillHeight = (filling.percentage / 100) * height;
|
|
248
|
+
fillY = y + height - fillHeight;
|
|
249
|
+
}
|
|
250
|
+
ctx.beginPath();
|
|
251
|
+
ctx.rect(fillX, fillY, fillWidth, fillHeight);
|
|
252
|
+
ctx.fillStyle = fillStyle;
|
|
253
|
+
ctx.fill();
|
|
254
|
+
ctx.restore();
|
|
226
255
|
}
|
|
227
256
|
else {
|
|
228
|
-
ctx.fillStyle =
|
|
257
|
+
ctx.fillStyle = fillStyle;
|
|
258
|
+
ctx.fill();
|
|
229
259
|
}
|
|
230
|
-
ctx.fill();
|
|
231
260
|
}
|
|
232
261
|
if (stroke) {
|
|
233
|
-
applyStroke(ctx, stroke, x, y, width, height);
|
|
262
|
+
applyStroke(ctx, stroke, x, y, width, height, shapeName, false);
|
|
234
263
|
}
|
|
235
264
|
ctx.restore();
|
|
236
265
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
*/
|
|
266
|
+
function drawHeart(ctx, x, y, width, height) {
|
|
267
|
+
ctx.beginPath();
|
|
268
|
+
ctx.moveTo(x + width / 2, y + height * 0.9);
|
|
269
|
+
ctx.bezierCurveTo(x + (width * 35) / 100, y + (height * 60) / 100, x + (width * 10) / 100, y + (height * 55) / 100, x + (width * 10) / 100, y + (height * 33.33) / 100);
|
|
270
|
+
ctx.bezierCurveTo(x + (width * 10) / 100, y + (height * 10) / 100, x + (width * 50) / 100, y + (height * 5) / 100, x + (width * 50) / 100, y + (height * 33.33) / 100);
|
|
271
|
+
ctx.bezierCurveTo(x + (width * 50) / 100, y + (height * 5) / 100, x + (width * 90) / 100, y + (height * 10) / 100, x + (width * 90) / 100, y + (height * 33.33) / 100);
|
|
272
|
+
ctx.bezierCurveTo(x + (width * 90) / 100, y + (height * 55) / 100, x + (width * 65) / 100, y + (height * 60) / 100, x + width / 2, y + height * 0.9);
|
|
273
|
+
ctx.closePath();
|
|
274
|
+
}
|
|
275
|
+
/** Draws a polygon with a given number of sides */
|
|
247
276
|
function drawPolygon(ctx, x, y, width, height, sides) {
|
|
248
277
|
const cx = x + width / 2;
|
|
249
278
|
const cy = y + height / 2;
|
|
250
279
|
const radius = Math.min(width, height) / 2;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
280
|
+
ctx.moveTo(cx + radius, cy);
|
|
281
|
+
for (let i = 1; i <= sides; i++) {
|
|
282
|
+
const angle = (Math.PI * 2 * i) / sides;
|
|
283
|
+
ctx.lineTo(cx + radius * Math.cos(angle), cy + radius * Math.sin(angle));
|
|
284
|
+
}
|
|
285
|
+
ctx.closePath();
|
|
286
|
+
}
|
|
287
|
+
function drawArrow(ctx, x, y, width, height) {
|
|
288
|
+
const shaftWidth = width * 0.25;
|
|
289
|
+
const headWidth = width * 0.5;
|
|
290
|
+
const headHeight = height * 0.6;
|
|
291
|
+
ctx.beginPath();
|
|
292
|
+
ctx.moveTo(x, y + height / 2 - shaftWidth / 2);
|
|
293
|
+
ctx.lineTo(x + width - headWidth, y + height / 2 - shaftWidth / 2);
|
|
294
|
+
ctx.lineTo(x + width - headWidth, y);
|
|
295
|
+
ctx.lineTo(x + width, y + height / 2);
|
|
296
|
+
ctx.lineTo(x + width - headWidth, y + height);
|
|
297
|
+
ctx.lineTo(x + width - headWidth, y + height / 2 + shaftWidth / 2);
|
|
298
|
+
ctx.lineTo(x, y + height / 2 + shaftWidth / 2);
|
|
299
|
+
ctx.closePath();
|
|
300
|
+
}
|
|
301
|
+
function drawStar(ctx, x, y, width, height) {
|
|
302
|
+
const cx = x + width / 2;
|
|
303
|
+
const cy = y + height / 2;
|
|
304
|
+
const size = Math.min(width, height);
|
|
305
|
+
const outerRadius = size / 2;
|
|
306
|
+
const innerRadius = outerRadius * 0.5;
|
|
307
|
+
const rotationOffset = -Math.PI / 2;
|
|
308
|
+
ctx.beginPath();
|
|
309
|
+
for (let i = 0; i < 5; i++) {
|
|
310
|
+
let angle = (i * (Math.PI * 2)) / 5 + rotationOffset;
|
|
311
|
+
ctx.lineTo(cx + outerRadius * Math.cos(angle), cy + outerRadius * Math.sin(angle));
|
|
312
|
+
angle += Math.PI / 5;
|
|
313
|
+
ctx.lineTo(cx + innerRadius * Math.cos(angle), cy + innerRadius * Math.sin(angle));
|
|
259
314
|
}
|
|
260
315
|
ctx.closePath();
|
|
261
316
|
}
|
|
@@ -273,9 +328,22 @@ function createGradient(ctx, gradientOptions, startX, startY, endX, endY) {
|
|
|
273
328
|
typeof endY !== "number") {
|
|
274
329
|
throw new Error("Invalid gradient options for linear gradient. Numeric values are required for startX, startY, endX, and endY.");
|
|
275
330
|
}
|
|
331
|
+
if (typeof gradientOptions.rotate === "number") {
|
|
332
|
+
const centerX = (startX + endX) / 2;
|
|
333
|
+
const centerY = (startY + endY) / 2;
|
|
334
|
+
const dx = endX - startX;
|
|
335
|
+
const dy = endY - startY;
|
|
336
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
337
|
+
const angleRad = (gradientOptions.rotate * Math.PI) / 180;
|
|
338
|
+
startX = centerX - (length / 2) * Math.cos(angleRad);
|
|
339
|
+
startY = centerY - (length / 2) * Math.sin(angleRad);
|
|
340
|
+
endX = centerX + (length / 2) * Math.cos(angleRad);
|
|
341
|
+
endY = centerY + (length / 2) * Math.sin(angleRad);
|
|
342
|
+
}
|
|
276
343
|
const gradient = ctx.createLinearGradient(startX, startY, endX, endY);
|
|
277
344
|
for (const colorStop of gradientOptions.colors) {
|
|
278
|
-
if (typeof colorStop.stop !== "number" ||
|
|
345
|
+
if (typeof colorStop.stop !== "number" ||
|
|
346
|
+
typeof colorStop.color !== "string") {
|
|
279
347
|
throw new Error("Invalid color stop. Each color stop should have a numeric stop value and a color string.");
|
|
280
348
|
}
|
|
281
349
|
gradient.addColorStop(colorStop.stop, colorStop.color);
|
|
@@ -293,7 +361,8 @@ function createGradient(ctx, gradientOptions, startX, startY, endX, endY) {
|
|
|
293
361
|
}
|
|
294
362
|
const gradient = ctx.createRadialGradient(gradientOptions.startX, gradientOptions.startY, gradientOptions.startRadius, gradientOptions.endX, gradientOptions.endY, gradientOptions.endRadius);
|
|
295
363
|
for (const colorStop of gradientOptions.colors) {
|
|
296
|
-
if (typeof colorStop.stop !== "number" ||
|
|
364
|
+
if (typeof colorStop.stop !== "number" ||
|
|
365
|
+
typeof colorStop.color !== "string") {
|
|
297
366
|
throw new Error("Invalid color stop. Each color stop should have a numeric stop value and a color string.");
|
|
298
367
|
}
|
|
299
368
|
gradient.addColorStop(colorStop.stop, colorStop.color);
|
|
@@ -343,49 +412,39 @@ function imageRadius(ctx, image, x, y, width, height, borderRadius, borderPositi
|
|
|
343
412
|
if (borderRadius === "circular") {
|
|
344
413
|
const circleRadius = Math.min(width, height) / 2;
|
|
345
414
|
ctx.arc(x + width / 2, y + height / 2, circleRadius, 0, 2 * Math.PI);
|
|
346
|
-
ctx.
|
|
415
|
+
ctx.clip();
|
|
347
416
|
}
|
|
348
|
-
else {
|
|
349
|
-
const br =
|
|
350
|
-
const
|
|
351
|
-
const
|
|
352
|
-
const
|
|
353
|
-
const
|
|
354
|
-
const
|
|
355
|
-
const roundBottomLeft = selectedCorners.has("all") || selectedCorners.has("bottom-left") || (selectedCorners.has("bottom") && selectedCorners.has("left"));
|
|
417
|
+
else if (typeof borderRadius === "number" && borderRadius > 0) {
|
|
418
|
+
const br = Math.min(borderRadius, width / 2, height / 2);
|
|
419
|
+
const selectedPositions = new Set(borderPosition.toLowerCase().split(",").map((s) => s.trim()));
|
|
420
|
+
const roundTopLeft = selectedPositions.has("all") || selectedPositions.has("top-left") || (selectedPositions.has("top") && selectedPositions.has("left"));
|
|
421
|
+
const roundTopRight = selectedPositions.has("all") || selectedPositions.has("top-right") || (selectedPositions.has("top") && selectedPositions.has("right"));
|
|
422
|
+
const roundBottomRight = selectedPositions.has("all") || selectedPositions.has("bottom-right") || (selectedPositions.has("bottom") && selectedPositions.has("right"));
|
|
423
|
+
const roundBottomLeft = selectedPositions.has("all") || selectedPositions.has("bottom-left") || (selectedPositions.has("bottom") && selectedPositions.has("left"));
|
|
356
424
|
const tl = roundTopLeft ? br : 0;
|
|
357
425
|
const tr = roundTopRight ? br : 0;
|
|
358
426
|
const brR = roundBottomRight ? br : 0;
|
|
359
427
|
const bl = roundBottomLeft ? br : 0;
|
|
360
428
|
ctx.moveTo(x + tl, y);
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
else if (roundTopLeft) {
|
|
365
|
-
ctx.arcTo(x, y, x + width, y, tl);
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
ctx.lineTo(x, y);
|
|
369
|
-
ctx.lineTo(x + width, y);
|
|
370
|
-
}
|
|
371
|
-
if (tr > 0) {
|
|
372
|
-
ctx.arcTo(x + width, y, x + width, y + height, tr);
|
|
373
|
-
}
|
|
429
|
+
ctx.lineTo(x + width - tr, y);
|
|
430
|
+
if (tr > 0)
|
|
431
|
+
ctx.arc(x + width - tr, y + tr, tr, -Math.PI / 2, 0, false);
|
|
374
432
|
ctx.lineTo(x + width, y + height - brR);
|
|
375
|
-
if (brR > 0)
|
|
376
|
-
ctx.
|
|
377
|
-
}
|
|
433
|
+
if (brR > 0)
|
|
434
|
+
ctx.arc(x + width - brR, y + height - brR, brR, 0, Math.PI / 2, false);
|
|
378
435
|
ctx.lineTo(x + bl, y + height);
|
|
379
|
-
if (bl > 0)
|
|
380
|
-
ctx.
|
|
381
|
-
}
|
|
436
|
+
if (bl > 0)
|
|
437
|
+
ctx.arc(x + bl, y + height - bl, bl, Math.PI / 2, Math.PI, false);
|
|
382
438
|
ctx.lineTo(x, y + tl);
|
|
383
|
-
if (tl > 0)
|
|
384
|
-
ctx.
|
|
385
|
-
}
|
|
439
|
+
if (tl > 0)
|
|
440
|
+
ctx.arc(x + tl, y + tl, tl, Math.PI, -Math.PI / 2, false);
|
|
386
441
|
ctx.closePath();
|
|
442
|
+
ctx.clip();
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
ctx.rect(x, y, width, height);
|
|
446
|
+
ctx.clip();
|
|
387
447
|
}
|
|
388
|
-
ctx.clip();
|
|
389
448
|
ctx.drawImage(image, x, y, width, height);
|
|
390
449
|
ctx.restore();
|
|
391
450
|
}
|
|
@@ -404,94 +463,41 @@ function imageRadius(ctx, image, x, y, width, height, borderRadius, borderPositi
|
|
|
404
463
|
* - "top-left", "top-right", "bottom-left", "bottom-right"
|
|
405
464
|
* - Or a comma-separated list, e.g. "top-left, bottom-right" or "top, left, bottom"
|
|
406
465
|
*/
|
|
407
|
-
function objectRadius(ctx, x, y, width, height, borderRadius = 0.1, borderPosition =
|
|
466
|
+
function objectRadius(ctx, x, y, width, height, borderRadius = 0.1, borderPosition = "all") {
|
|
467
|
+
ctx.beginPath();
|
|
408
468
|
if (borderRadius === "circular") {
|
|
409
469
|
const circleRadius = Math.min(width, height) / 2;
|
|
410
|
-
ctx.beginPath();
|
|
411
470
|
ctx.arc(x + width / 2, y + height / 2, circleRadius, 0, 2 * Math.PI);
|
|
412
|
-
ctx.closePath();
|
|
413
471
|
}
|
|
414
|
-
else if (borderRadius) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
else if (bp === 'bottom') {
|
|
427
|
-
roundBottomLeft = roundBottomRight = true;
|
|
428
|
-
}
|
|
429
|
-
else if (bp === 'left') {
|
|
430
|
-
roundTopLeft = roundBottomLeft = true;
|
|
431
|
-
}
|
|
432
|
-
else if (bp === 'right') {
|
|
433
|
-
roundTopRight = roundBottomRight = true;
|
|
434
|
-
}
|
|
435
|
-
else if (bp === 'top-left') {
|
|
436
|
-
roundTopLeft = true;
|
|
437
|
-
}
|
|
438
|
-
else if (bp === 'top-right') {
|
|
439
|
-
roundTopRight = true;
|
|
440
|
-
}
|
|
441
|
-
else if (bp === 'bottom-left') {
|
|
442
|
-
roundBottomLeft = true;
|
|
443
|
-
}
|
|
444
|
-
else if (bp === 'bottom-right') {
|
|
445
|
-
roundBottomRight = true;
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
const positions = bp.split(',').map(s => s.trim());
|
|
449
|
-
roundTopLeft = positions.includes('top-left') || (positions.includes('top') && positions.includes('left'));
|
|
450
|
-
roundTopRight = positions.includes('top-right') || (positions.includes('top') && positions.includes('right'));
|
|
451
|
-
roundBottomRight = positions.includes('bottom-right') || (positions.includes('bottom') && positions.includes('right'));
|
|
452
|
-
roundBottomLeft = positions.includes('bottom-left') || (positions.includes('bottom') && positions.includes('left'));
|
|
453
|
-
}
|
|
454
|
-
const tl = roundTopLeft ? +borderRadius : 0;
|
|
455
|
-
const tr = roundTopRight ? +borderRadius : 0;
|
|
456
|
-
const br = roundBottomRight ? +borderRadius : 0;
|
|
457
|
-
const bl = roundBottomLeft ? +borderRadius : 0;
|
|
458
|
-
ctx.beginPath();
|
|
472
|
+
else if (borderRadius > 0) {
|
|
473
|
+
const br = Math.min(borderRadius, width / 2, height / 2);
|
|
474
|
+
const selectedPositions = new Set(borderPosition.toLowerCase().split(",").map((s) => s.trim()));
|
|
475
|
+
const roundTopLeft = selectedPositions.has("all") || selectedPositions.has("top-left") || (selectedPositions.has("top") && selectedPositions.has("left"));
|
|
476
|
+
const roundTopRight = selectedPositions.has("all") || selectedPositions.has("top-right") || (selectedPositions.has("top") && selectedPositions.has("right"));
|
|
477
|
+
const roundBottomRight = selectedPositions.has("all") || selectedPositions.has("bottom-right") || (selectedPositions.has("bottom") && selectedPositions.has("right"));
|
|
478
|
+
const roundBottomLeft = selectedPositions.has("all") || selectedPositions.has("bottom-left") || (selectedPositions.has("bottom") && selectedPositions.has("left"));
|
|
479
|
+
const tl = roundTopLeft ? br : 0;
|
|
480
|
+
const tr = roundTopRight ? br : 0;
|
|
481
|
+
const brR = roundBottomRight ? br : 0;
|
|
482
|
+
const bl = roundBottomLeft ? br : 0;
|
|
459
483
|
ctx.moveTo(x + tl, y);
|
|
460
484
|
ctx.lineTo(x + width - tr, y);
|
|
461
|
-
if (tr > 0)
|
|
462
|
-
ctx.
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
ctx.
|
|
466
|
-
}
|
|
467
|
-
ctx.lineTo(x + width, y + height - br);
|
|
468
|
-
if (br > 0) {
|
|
469
|
-
ctx.quadraticCurveTo(x + width, y + height, x + width - br, y + height);
|
|
470
|
-
}
|
|
471
|
-
else {
|
|
472
|
-
ctx.lineTo(x + width, y + height);
|
|
473
|
-
}
|
|
485
|
+
if (tr > 0)
|
|
486
|
+
ctx.arc(x + width - tr, y + tr, tr, -Math.PI / 2, 0, false);
|
|
487
|
+
ctx.lineTo(x + width, y + height - brR);
|
|
488
|
+
if (brR > 0)
|
|
489
|
+
ctx.arc(x + width - brR, y + height - brR, brR, 0, Math.PI / 2, false);
|
|
474
490
|
ctx.lineTo(x + bl, y + height);
|
|
475
|
-
if (bl > 0)
|
|
476
|
-
ctx.
|
|
477
|
-
}
|
|
478
|
-
else {
|
|
479
|
-
ctx.lineTo(x, y + height);
|
|
480
|
-
}
|
|
491
|
+
if (bl > 0)
|
|
492
|
+
ctx.arc(x + bl, y + height - bl, bl, Math.PI / 2, Math.PI, false);
|
|
481
493
|
ctx.lineTo(x, y + tl);
|
|
482
|
-
if (tl > 0)
|
|
483
|
-
ctx.
|
|
484
|
-
}
|
|
485
|
-
else {
|
|
486
|
-
ctx.lineTo(x, y);
|
|
487
|
-
}
|
|
488
|
-
ctx.closePath();
|
|
494
|
+
if (tl > 0)
|
|
495
|
+
ctx.arc(x + tl, y + tl, tl, Math.PI, -Math.PI / 2, false);
|
|
489
496
|
}
|
|
490
497
|
else {
|
|
491
|
-
ctx.beginPath();
|
|
492
498
|
ctx.rect(x, y, width, height);
|
|
493
|
-
ctx.closePath();
|
|
494
499
|
}
|
|
500
|
+
ctx.closePath();
|
|
495
501
|
}
|
|
496
502
|
/**
|
|
497
503
|
* Performs bilinear interpolation on four corners.
|