apexify.js 4.9.28 → 4.9.30

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.
Files changed (32) hide show
  1. package/README.md +672 -456
  2. package/dist/cjs/Canvas/ApexPainter.d.ts.map +1 -1
  3. package/dist/cjs/Canvas/ApexPainter.js +169 -2
  4. package/dist/cjs/Canvas/ApexPainter.js.map +1 -1
  5. package/dist/cjs/Canvas/utils/Image/imageProperties.d.ts.map +1 -1
  6. package/dist/cjs/Canvas/utils/Image/imageProperties.js +181 -2
  7. package/dist/cjs/Canvas/utils/Image/imageProperties.js.map +1 -1
  8. package/dist/cjs/Canvas/utils/Texts/enhancedTextRenderer.d.ts +33 -0
  9. package/dist/cjs/Canvas/utils/Texts/enhancedTextRenderer.d.ts.map +1 -1
  10. package/dist/cjs/Canvas/utils/Texts/enhancedTextRenderer.js +237 -32
  11. package/dist/cjs/Canvas/utils/Texts/enhancedTextRenderer.js.map +1 -1
  12. package/dist/cjs/Canvas/utils/types.d.ts +50 -10
  13. package/dist/cjs/Canvas/utils/types.d.ts.map +1 -1
  14. package/dist/cjs/Canvas/utils/types.js.map +1 -1
  15. package/dist/esm/Canvas/ApexPainter.d.ts.map +1 -1
  16. package/dist/esm/Canvas/ApexPainter.js +169 -2
  17. package/dist/esm/Canvas/ApexPainter.js.map +1 -1
  18. package/dist/esm/Canvas/utils/Image/imageProperties.d.ts.map +1 -1
  19. package/dist/esm/Canvas/utils/Image/imageProperties.js +181 -2
  20. package/dist/esm/Canvas/utils/Image/imageProperties.js.map +1 -1
  21. package/dist/esm/Canvas/utils/Texts/enhancedTextRenderer.d.ts +33 -0
  22. package/dist/esm/Canvas/utils/Texts/enhancedTextRenderer.d.ts.map +1 -1
  23. package/dist/esm/Canvas/utils/Texts/enhancedTextRenderer.js +237 -32
  24. package/dist/esm/Canvas/utils/Texts/enhancedTextRenderer.js.map +1 -1
  25. package/dist/esm/Canvas/utils/types.d.ts +50 -10
  26. package/dist/esm/Canvas/utils/types.d.ts.map +1 -1
  27. package/dist/esm/Canvas/utils/types.js.map +1 -1
  28. package/lib/Canvas/ApexPainter.ts +192 -2
  29. package/lib/Canvas/utils/Image/imageProperties.ts +207 -2
  30. package/lib/Canvas/utils/Texts/enhancedTextRenderer.ts +274 -36
  31. package/lib/Canvas/utils/types.ts +52 -10
  32. package/package.json +1 -1
package/README.md CHANGED
@@ -1,456 +1,672 @@
1
- # 🎨 ApexPainter - Advanced Canvas Rendering Library
2
-
3
- <div align="center">
4
-
5
- ![ApexPainter Banner](apex-banner.png)
6
-
7
- **The Ultimate TypeScript Canvas Library for Node.js**
8
-
9
- [![npm version](https://badge.fury.io/js/apexify.svg)](https://badge.fury.io/js/apexify)
10
- [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
11
- [![Node.js](https://img.shields.io/badge/Node.js-16%2B-green.svg)](https://nodejs.org/)
12
- [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
13
-
14
- *Create stunning visuals with professional-grade canvas rendering, image processing, and text effects*
15
-
16
- </div>
17
-
18
- ## ✨ Features Overview
19
-
20
- ### 🖼️ **Advanced Image Processing**
21
- - **Professional Filters**: 22+ filters including blur, sharpen, vintage, cinematic effects
22
- - **Shape Drawing**: 8+ shapes (rectangle, circle, heart, star, polygon, etc.)
23
- - **Gradient Support**: Linear and radial gradients for fills and strokes
24
- - **Shadow & Stroke Effects**: Customizable shadows and strokes for all shapes
25
- - **Rotation & Positioning**: Full control over image placement and rotation
26
-
27
- ### 🎨 **Rich Background System**
28
- - **Multiple Background Types**: Solid colors, gradients, custom images
29
- - **Pattern Overlays**: 12+ built-in patterns (grid, dots, stripes, hexagons, etc.)
30
- - **Custom Patterns**: Use your own images as repeating patterns
31
- - **Blend Modes**: 11+ blend modes for professional compositing
32
- - **Noise Effects**: Add texture with customizable noise intensity
33
-
34
- ### 📝 **Enhanced Text Rendering**
35
- - **Font Management**: Custom fonts, sizes, families, and styles
36
- - **Text Decorations**: Bold, italic, underline, overline, strikethrough, highlight
37
- - **Advanced Effects**: Glow, shadow, stroke with gradient support
38
- - **Spacing Control**: Letter spacing, word spacing, line height
39
- - **Text Wrapping**: Automatic text wrapping with size constraints
40
- - **Rotation**: Full 360° text rotation support
41
-
42
- ### 🔧 **Professional Tools**
43
- - **Chart Generation**: Bar charts, pie charts, line charts
44
- - **GIF Creation**: Animated GIFs from image sequences
45
- - **Format Conversion**: Convert between PNG, JPEG, WebP, and more
46
- - **Image Manipulation**: Crop, resize, background removal
47
- - **Color Detection**: Extract and analyze colors from images
48
-
49
- ---
50
-
51
- ## 🚀 Quick Start
52
-
53
- ### Installation
54
-
55
- ```bash
56
- npm install apexify
57
- ```
58
-
59
- ### Basic Usage
60
-
61
- ```typescript
62
- import { ApexPainter } from 'apexify';
63
-
64
- const painter = new ApexPainter();
65
-
66
- // Create a canvas with gradient background
67
- const canvas = await painter.createCanvas({
68
- width: 800,
69
- height: 600,
70
- gradientBg: {
71
- type: 'linear',
72
- colors: [
73
- { color: '#FF6B6B', position: 0 },
74
- { color: '#4ECDC4', position: 0.5 },
75
- { color: '#45B7D1', position: 1 }
76
- ],
77
- direction: { x1: 0, y1: 0, x2: 800, y2: 600 }
78
- },
79
- shadow: {
80
- color: '#000',
81
- offsetX: 10,
82
- offsetY: 10,
83
- blur: 20
84
- },
85
- borderRadius: 20
86
- });
87
-
88
- // Add a beautiful heart shape (single object)
89
- const heartImage = await painter.createImage({
90
- source: 'heart',
91
- x: 300,
92
- y: 200,
93
- width: 200,
94
- height: 200,
95
- shape: {
96
- fill: true,
97
- gradient: {
98
- type: 'radial',
99
- colors: [
100
- { color: '#FF6B6B', position: 0 },
101
- { color: '#FF1744', position: 1 }
102
- ],
103
- center: { x: 100, y: 100 },
104
- radius: 100
105
- }
106
- },
107
- shadow: {
108
- color: '#000',
109
- offsetX: 15,
110
- offsetY: 15,
111
- blur: 25
112
- },
113
- stroke: {
114
- color: '#FFF',
115
- width: 5
116
- }
117
- }, canvas.buffer);
118
-
119
- // Add stunning text (single object)
120
- const textImage = await painter.createText({
121
- text: 'ApexPainter',
122
- x: 400,
123
- y: 450,
124
- fontSize: 48,
125
- fontFamily: 'Arial',
126
- bold: true,
127
- gradient: {
128
- type: 'linear',
129
- colors: [
130
- { color: '#FFD700', position: 0 },
131
- { color: '#FF6B6B', position: 1 }
132
- ],
133
- direction: { x1: 0, y1: 0, x2: 300, y2: 0 }
134
- },
135
- glow: {
136
- color: '#FFD700',
137
- intensity: 0.8,
138
- opacity: 0.9
139
- },
140
- shadow: {
141
- color: '#000',
142
- offsetX: 8,
143
- offsetY: 8,
144
- blur: 15
145
- },
146
- stroke: {
147
- color: '#FFF',
148
- width: 3
149
- }
150
- }, heartImage);
151
-
152
- // Save the result
153
- fs.writeFileSync('beautiful-artwork.png', textImage);
154
- ```
155
-
156
- ### 📝 **Flexible Array Support**
157
-
158
- Both `createImage()` and `createText()` methods accept **single objects** OR **arrays of objects**:
159
-
160
- ```typescript
161
- // ✅ Single Object
162
- await painter.createImage({
163
- source: 'heart',
164
- x: 100, y: 100,
165
- width: 200, height: 200,
166
- shape: { fill: true, color: '#ff6b6b' }
167
- }, canvasBuffer);
168
-
169
- // ✅ Array of Objects
170
- await painter.createImage([
171
- {
172
- source: 'rectangle',
173
- x: 50, y: 50,
174
- width: 100, height: 80,
175
- shape: { fill: true, color: '#ff6b6b' }
176
- },
177
- {
178
- source: 'circle',
179
- x: 200, y: 50,
180
- width: 80, height: 80,
181
- shape: { fill: true, color: '#4ecdc4' }
182
- },
183
- {
184
- source: 'star',
185
- x: 350, y: 50,
186
- width: 80, height: 80,
187
- shape: { fill: true, color: '#45b7d1' }
188
- }
189
- ], canvasBuffer);
190
-
191
- // ✅ Single Text Object
192
- await painter.createText({
193
- text: 'Hello World',
194
- x: 100, y: 100,
195
- fontSize: 24,
196
- color: '#ff6b6b'
197
- }, canvasBuffer);
198
-
199
- // ✅ Array of Text Objects
200
- await painter.createText([
201
- {
202
- text: 'Title',
203
- x: 100, y: 50,
204
- fontSize: 32,
205
- bold: true,
206
- color: '#2c3e50'
207
- },
208
- {
209
- text: 'Subtitle',
210
- x: 100, y: 100,
211
- fontSize: 18,
212
- color: '#666'
213
- },
214
- {
215
- text: 'Body text with effects',
216
- x: 100, y: 150,
217
- fontSize: 14,
218
- color: '#333',
219
- glow: { color: '#ffd700', intensity: 0.5 },
220
- shadow: { color: '#000', offsetX: 2, offsetY: 2, blur: 4 }
221
- }
222
- ], canvasBuffer);
223
- ```
224
-
225
- ---
226
-
227
- ## 🎯 Real-World Examples
228
-
229
- ### 🏢 **Business Cards & Marketing Materials**
230
-
231
- ```typescript
232
- // Create a professional business card
233
- const businessCard = await painter.createCanvas({
234
- width: 400,
235
- height: 250,
236
- gradientBg: {
237
- type: 'linear',
238
- colors: [
239
- { color: '#2C3E50', position: 0 },
240
- { color: '#34495E', position: 1 }
241
- ],
242
- direction: { x1: 0, y1: 0, x2: 400, y2: 250 }
243
- },
244
- patternBg: {
245
- type: 'dots',
246
- color: '#FFF',
247
- opacity: 0.1,
248
- size: 5,
249
- spacing: 20
250
- }
251
- });
252
-
253
- // Add company logo (star shape)
254
- const logo = await painter.createImage({
255
- source: 'star',
256
- x: 50,
257
- y: 50,
258
- width: 60,
259
- height: 60,
260
- fill: true,
261
- color: '#FFD700',
262
- shadow: { color: '#000', offsetX: 3, offsetY: 3, blur: 8 }
263
- }, businessCard.buffer);
264
-
265
- // Add company name
266
- const companyText = await painter.createText({
267
- text: 'ACME Corp',
268
- x: 130,
269
- y: 80,
270
- fontSize: 24,
271
- fontFamily: 'Arial',
272
- bold: true,
273
- color: '#FFF',
274
- shadow: { color: '#000', offsetX: 2, offsetY: 2, blur: 4 }
275
- }, logo);
276
-
277
- // Add contact info
278
- const contactText = await painter.createText({
279
- text: 'john@acme.com\n+1 (555) 123-4567',
280
- x: 50,
281
- y: 150,
282
- fontSize: 14,
283
- fontFamily: 'Arial',
284
- color: '#BDC3C7',
285
- lineHeight: 1.5
286
- }, companyText);
287
- ```
288
-
289
- ### 🎮 **Game UI Elements**
290
-
291
- ```typescript
292
- // Create a game button
293
- const gameButton = await painter.createCanvas({
294
- width: 200,
295
- height: 60,
296
- gradientBg: {
297
- type: 'linear',
298
- colors: [
299
- { color: '#FF6B6B', position: 0 },
300
- { color: '#FF1744', position: 1 }
301
- ],
302
- direction: { x1: 0, y1: 0, x2: 200, y2: 60 }
303
- },
304
- shadow: {
305
- color: '#000',
306
- offsetX: 5,
307
- offsetY: 5,
308
- blur: 15
309
- },
310
- borderRadius: 30
311
- });
312
-
313
- // Add button text with glow effect
314
- const buttonText = await painter.createText({
315
- text: 'PLAY NOW',
316
- x: 100,
317
- y: 35,
318
- fontSize: 20,
319
- fontFamily: 'Arial',
320
- bold: true,
321
- color: '#FFF',
322
- textAlign: 'center',
323
- textBaseline: 'middle',
324
- glow: {
325
- color: '#FFD700',
326
- intensity: 0.6,
327
- opacity: 0.8
328
- },
329
- shadow: {
330
- color: '#000',
331
- offsetX: 2,
332
- offsetY: 2,
333
- blur: 4
334
- }
335
- }, gameButton.buffer);
336
- ```
337
-
338
- ---
339
-
340
- ## 📚 API Reference
341
-
342
- ### Core Methods
343
-
344
- | Method | Description | Parameters |
345
- |--------|-------------|------------|
346
- | `createCanvas()` | Create a new canvas with background | `CanvasConfig` |
347
- | `createImage()` | Add shapes/images to canvas | `ImageProperties \| ImageProperties[]` |
348
- | `createText()` | Add text to canvas | `TextProperties \| TextProperties[]` |
349
- | `createChart()` | Generate charts | `ChartConfig` |
350
- | `createGIF()` | Create animated GIFs | `GIFConfig` |
351
-
352
- ### 🔄 **Flexible Parameters**
353
-
354
- Both `createImage()` and `createText()` methods accept:
355
- - **Single Object**: `ImageProperties` or `TextProperties`
356
- - **Array of Objects**: `ImageProperties[]` or `TextProperties[]`
357
-
358
- This allows you to add multiple elements in one call for better performance and cleaner code.
359
-
360
- ### Shape Types
361
-
362
- - `rectangle` - Standard rectangle
363
- - `square` - Perfect square
364
- - `circle` - Perfect circle
365
- - `triangle` - Equilateral triangle
366
- - `trapezium` - Trapezoid shape
367
- - `star` - 5-pointed star
368
- - `heart` - Heart shape with bezier curves
369
- - `polygon` - Custom polygon
370
-
371
- ### Pattern Types
372
-
373
- - `grid` - Grid pattern
374
- - `dots` - Dot pattern
375
- - `diagonal` - Diagonal lines
376
- - `stripes` - Horizontal/vertical stripes
377
- - `waves` - Wave pattern
378
- - `crosses` - Cross pattern
379
- - `hexagons` - Hexagonal pattern
380
- - `checkerboard` - Checkerboard pattern
381
- - `diamonds` - Diamond pattern
382
- - `triangles` - Triangle pattern
383
- - `stars` - Star pattern
384
- - `polka` - Polka dot pattern
385
- - `custom` - Custom image pattern
386
-
387
- ---
388
-
389
- ## 🤝 Contributing
390
-
391
- We welcome contributions! Here's how you can help:
392
-
393
- 1. **Report Bugs**: Found a bug? Open an issue with detailed information
394
- 2. **Feature Requests**: Have an idea? We'd love to hear it!
395
- 3. **Code Contributions**: Submit pull requests for improvements
396
- 4. **Documentation**: Help improve our docs and examples
397
-
398
- ### Development Setup
399
-
400
- ```bash
401
- # Clone the repository
402
- git clone https://github.com/your-username/apexify.git
403
-
404
- # Install dependencies
405
- npm install
406
-
407
- # Run tests
408
- npm test
409
-
410
- # Build the project
411
- npm run build
412
- ```
413
-
414
- ---
415
-
416
- ## 📞 Support & Community
417
-
418
- <div align="center">
419
-
420
- ### Join Our Discord Community
421
-
422
- [![Jedi Studio](https://img.shields.io/badge/Discord-Jedi%20Studio-7289DA?style=for-the-badge&logo=discord)](https://discord.gg/CS2NRSPyze)
423
- [![FresedGPT](https://img.shields.io/badge/Discord-FresedGPT-7289DA?style=for-the-badge&logo=discord)](https://discord.gg/94qUZWhwFE)
424
- [![ElectronHub](https://img.shields.io/badge/Discord-ElectronHub-7289DA?style=for-the-badge&logo=discord)](https://discord.gg/83XcjD8vgW)
425
-
426
- ### Documentation & Resources
427
-
428
- [![Documentation](https://img.shields.io/badge/Docs-Apexify.js-blue?style=for-the-badge)](http://apexifyjs.jedi-studio.com)
429
- [![Support Server](https://img.shields.io/badge/Support-Discord-7289DA?style=for-the-badge&logo=discord)](https://discord.gg/mDyXV9hzXw)
430
-
431
- </div>
432
-
433
- ---
434
-
435
- ## 📄 License
436
-
437
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
438
-
439
- ---
440
-
441
- ## 🙏 Acknowledgments
442
-
443
- - **@napi-rs/canvas** - High-performance canvas rendering
444
- - **Sharp** - Professional image processing
445
- - **Jimp** - JavaScript image manipulation
446
- - **TypeScript** - Type-safe development
447
-
448
- ---
449
-
450
- <div align="center">
451
-
452
- **Made with ❤️ by [Jedi Studio](https://discord.gg/CS2NRSPyze)**
453
-
454
- *Create stunning visuals with ApexPainter - The ultimate canvas library for Node.js*
455
-
456
- </div>
1
+ # 🎨 ApexPainter - Advanced Canvas Rendering Library
2
+
3
+ <div align="center">
4
+
5
+ ![ApexPainter Banner](./apex-banner.png)
6
+
7
+ **The Ultimate TypeScript Canvas Library for Node.js**
8
+
9
+ [![npm version](https://badge.fury.io/js/apexify.svg)](https://badge.fury.io/js/apexify)
10
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
11
+ [![Node.js](https://img.shields.io/badge/Node.js-16%2B-green.svg)](https://nodejs.org/)
12
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
13
+
14
+ *Create stunning visuals with professional-grade canvas rendering, image processing, and text effects*
15
+
16
+ </div>
17
+
18
+ ## ✨ Features Overview
19
+
20
+ ### 🖼️ **Advanced Image Processing**
21
+ - **Professional Filters**: 22+ filters including blur, sharpen, vintage, cinematic effects
22
+ - **Shape Drawing**: 8+ shapes (rectangle, circle, heart, star, polygon, etc.)
23
+ - **Gradient Support**: Linear and radial gradients for fills and strokes
24
+ - **Shadow & Stroke Effects**: Customizable shadows and strokes for all shapes
25
+ - **Rotation & Positioning**: Full control over image placement and rotation
26
+
27
+ ### 🎨 **Rich Background System**
28
+ - **Multiple Background Types**: Solid colors, gradients, custom images
29
+ - **Pattern Overlays**: 12+ built-in patterns (grid, dots, stripes, hexagons, etc.)
30
+ - **Custom Patterns**: Use your own images as repeating patterns
31
+ - **Blend Modes**: 11+ blend modes for professional compositing
32
+ - **Noise Effects**: Add texture with customizable noise intensity
33
+
34
+ ### 📝 **Enhanced Text Rendering**
35
+ - **Font Management**: Custom fonts, sizes, families, and styles
36
+ - **Text Decorations**: Bold, italic, underline, overline, strikethrough, highlight
37
+ - **Advanced Effects**: Glow, shadow, stroke with gradient support
38
+ - **Spacing Control**: Letter spacing, word spacing, line height
39
+ - **Text Wrapping**: Automatic text wrapping with size constraints
40
+ - **Rotation**: Full 360° text rotation support
41
+
42
+ ### 🔧 **Professional Tools**
43
+ - **Chart Generation**: Bar charts, pie charts, line charts
44
+ - **GIF Creation**: Animated GIFs from image sequences
45
+ - **Format Conversion**: Convert between PNG, JPEG, WebP, and more
46
+ - **Image Manipulation**: Crop, resize, background removal
47
+ - **Color Detection**: Extract and analyze colors from images
48
+
49
+ ---
50
+
51
+ ## 🚀 Quick Start
52
+
53
+ ### Installation
54
+
55
+ ```bash
56
+ npm install apexify
57
+ ```
58
+
59
+ ### Basic Usage
60
+
61
+ ```typescript
62
+ import { ApexPainter } from 'apexify';
63
+
64
+ const painter = new ApexPainter();
65
+
66
+ // Create a canvas with gradient background
67
+ const canvas = await painter.createCanvas({
68
+ width: 800,
69
+ height: 600,
70
+ gradientBg: {
71
+ type: 'linear',
72
+ colors: [
73
+ { color: '#FF6B6B', position: 0 },
74
+ { color: '#4ECDC4', position: 0.5 },
75
+ { color: '#45B7D1', position: 1 }
76
+ ],
77
+ direction: { x1: 0, y1: 0, x2: 800, y2: 600 }
78
+ },
79
+ shadow: {
80
+ color: '#000',
81
+ offsetX: 10,
82
+ offsetY: 10,
83
+ blur: 20
84
+ },
85
+ borderRadius: 20
86
+ });
87
+
88
+ // Add a beautiful heart shape (single object)
89
+ const heartImage = await painter.createImage({
90
+ source: 'heart',
91
+ x: 300,
92
+ y: 200,
93
+ width: 200,
94
+ height: 200,
95
+ shape: {
96
+ fill: true,
97
+ gradient: {
98
+ type: 'radial',
99
+ colors: [
100
+ { color: '#FF6B6B', position: 0 },
101
+ { color: '#FF1744', position: 1 }
102
+ ],
103
+ center: { x: 100, y: 100 },
104
+ radius: 100
105
+ }
106
+ },
107
+ shadow: {
108
+ color: '#000',
109
+ offsetX: 15,
110
+ offsetY: 15,
111
+ blur: 25
112
+ },
113
+ stroke: {
114
+ color: '#FFF',
115
+ width: 5
116
+ }
117
+ }, canvas.buffer);
118
+
119
+ // Add stunning text (single object)
120
+ const textImage = await painter.createText({
121
+ text: 'ApexPainter',
122
+ x: 400,
123
+ y: 450,
124
+ fontSize: 48,
125
+ fontFamily: 'Arial',
126
+ bold: true,
127
+ gradient: {
128
+ type: 'linear',
129
+ colors: [
130
+ { color: '#FFD700', position: 0 },
131
+ { color: '#FF6B6B', position: 1 }
132
+ ],
133
+ direction: { x1: 0, y1: 0, x2: 300, y2: 0 }
134
+ },
135
+ glow: {
136
+ color: '#FFD700',
137
+ intensity: 0.8,
138
+ opacity: 0.9
139
+ },
140
+ shadow: {
141
+ color: '#000',
142
+ offsetX: 8,
143
+ offsetY: 8,
144
+ blur: 15
145
+ },
146
+ stroke: {
147
+ color: '#FFF',
148
+ width: 3
149
+ }
150
+ }, heartImage);
151
+
152
+ // Save the result
153
+ fs.writeFileSync('beautiful-artwork.png', textImage);
154
+ ```
155
+
156
+ ### 📝 **Flexible Array Support**
157
+
158
+ Both `createImage()` and `createText()` methods accept **single objects** OR **arrays of objects**:
159
+
160
+ ```typescript
161
+ // ✅ Single Object
162
+ await painter.createImage({
163
+ source: 'heart',
164
+ x: 100, y: 100,
165
+ width: 200, height: 200,
166
+ shape: { fill: true, color: '#ff6b6b' }
167
+ }, canvasBuffer);
168
+
169
+ // ✅ Array of Objects
170
+ await painter.createImage([
171
+ {
172
+ source: 'rectangle',
173
+ x: 50, y: 50,
174
+ width: 100, height: 80,
175
+ shape: { fill: true, color: '#ff6b6b' }
176
+ },
177
+ {
178
+ source: 'circle',
179
+ x: 200, y: 50,
180
+ width: 80, height: 80,
181
+ shape: { fill: true, color: '#4ecdc4' }
182
+ },
183
+ {
184
+ source: 'star',
185
+ x: 350, y: 50,
186
+ width: 80, height: 80,
187
+ shape: { fill: true, color: '#45b7d1' }
188
+ }
189
+ ], canvasBuffer);
190
+
191
+ // ✅ Single Text Object
192
+ await painter.createText({
193
+ text: 'Hello World',
194
+ x: 100, y: 100,
195
+ fontSize: 24,
196
+ color: '#ff6b6b'
197
+ }, canvasBuffer);
198
+
199
+ // ✅ Array of Text Objects
200
+ await painter.createText([
201
+ {
202
+ text: 'Title',
203
+ x: 100, y: 50,
204
+ fontSize: 32,
205
+ bold: true,
206
+ color: '#2c3e50'
207
+ },
208
+ {
209
+ text: 'Subtitle',
210
+ x: 100, y: 100,
211
+ fontSize: 18,
212
+ color: '#666'
213
+ },
214
+ {
215
+ text: 'Body text with effects',
216
+ x: 100, y: 150,
217
+ fontSize: 14,
218
+ color: '#333',
219
+ glow: { color: '#ffd700', intensity: 0.5 },
220
+ shadow: { color: '#000', offsetX: 2, offsetY: 2, blur: 4 }
221
+ }
222
+ ], canvasBuffer);
223
+ ```
224
+
225
+ ### 🎨 **Advanced Stroke Styles**
226
+
227
+ All stroke properties now support **6 different stroke styles**:
228
+
229
+ ```typescript
230
+ // ✅ Basic Stroke Styles
231
+ await painter.createImage({
232
+ source: 'rectangle',
233
+ x: 100, y: 100,
234
+ width: 200, height: 150,
235
+ shape: { fill: true, color: '#ffffff' },
236
+ stroke: {
237
+ color: '#ff6b6b',
238
+ width: 8,
239
+ style: 'dashed' // solid, dashed, dotted, groove, ridge, double
240
+ }
241
+ }, canvasBuffer);
242
+
243
+ // ✅ Gradient Strokes with Styles
244
+ await painter.createImage({
245
+ source: 'circle',
246
+ x: 200, y: 200,
247
+ width: 150, height: 150,
248
+ shape: { fill: true, color: '#ffffff' },
249
+ stroke: {
250
+ gradient: {
251
+ type: 'linear',
252
+ colors: [
253
+ { stop: 0, color: '#ff6b6b' },
254
+ { stop: 1, color: '#4ecdc4' }
255
+ ]
256
+ },
257
+ width: 6,
258
+ style: 'ridge' // Works with all styles!
259
+ }
260
+ }, canvasBuffer);
261
+
262
+ // Text Strokes with Styles
263
+ await painter.createText({
264
+ text: 'Styled Text',
265
+ x: 100, y: 100,
266
+ fontSize: 32,
267
+ color: '#ffffff',
268
+ stroke: {
269
+ color: '#ff6b6b',
270
+ width: 4,
271
+ style: 'double' // All 6 styles supported!
272
+ }
273
+ }, canvasBuffer);
274
+ ```
275
+
276
+ **Available Stroke Styles:**
277
+ - `solid` - Clean solid line (default)
278
+ - `dashed` - Dashed line pattern
279
+ - `dotted` - Dotted line pattern
280
+ - `groove` - 3D grooved effect (dark outer, light inner)
281
+ - `ridge` - 3D ridged effect (light outer, dark inner)
282
+ - `double` - Double parallel lines
283
+
284
+ ### 🔤 **Organized Font Management**
285
+
286
+ Text fonts are now organized in a clean `font` object structure:
287
+
288
+ ```typescript
289
+ // New Font Object Structure
290
+ await painter.createText({
291
+ text: 'Organized Font',
292
+ x: 100, y: 100,
293
+ font: {
294
+ size: 24, // Font size in pixels
295
+ family: 'Arial', // Font family name
296
+ name: 'customFont', // Custom font name (for registration)
297
+ path: './fonts/custom.ttf' // Path to custom font file
298
+ },
299
+ color: '#333333',
300
+ bold: true,
301
+ italic: true
302
+ }, canvasBuffer);
303
+
304
+ // ✅ Backward Compatibility (Legacy Properties)
305
+ await painter.createText({
306
+ text: 'Legacy Font Properties',
307
+ x: 100, y: 150,
308
+ fontSize: 24, // Still works!
309
+ fontFamily: 'Arial', // Still works!
310
+ fontName: 'customFont', // Still works!
311
+ fontPath: './fonts/custom.ttf', // Still works!
312
+ color: '#333333'
313
+ }, canvasBuffer);
314
+
315
+ // Mixed Usage (New Object Takes Priority)
316
+ await painter.createText({
317
+ text: 'Mixed Usage',
318
+ x: 100, y: 200,
319
+ font: {
320
+ size: 28,
321
+ family: 'Georgia'
322
+ },
323
+ fontSize: 24, // Ignored (font.size takes priority)
324
+ fontFamily: 'Arial', // Ignored (font.family takes priority)
325
+ color: '#333333'
326
+ }, canvasBuffer);
327
+ ```
328
+
329
+ **Font Object Properties:**
330
+ - `size` - Font size in pixels (replaces `fontSize`)
331
+ - `family` - Font family name (replaces `fontFamily`)
332
+ - `name` - Custom font name for registration (replaces `fontName`)
333
+ - `path` - Path to custom font file (replaces `fontPath`)
334
+
335
+ **Benefits:**
336
+ - **Cleaner Structure**: All font properties in one organized object
337
+ - **Better IntelliSense**: IDE autocomplete for font properties
338
+ - **Backward Compatible**: Legacy properties still work
339
+ - **Priority System**: New `font` object overrides legacy properties
340
+
341
+ ### 🌈 **Advanced Text Gradient Features**
342
+
343
+ Text effects now support **gradients** for enhanced visual appeal:
344
+
345
+ ```typescript
346
+ // Gradient Glow
347
+ await painter.createText({
348
+ text: 'Gradient Glow Text',
349
+ x: 100, y: 100,
350
+ fontSize: 32,
351
+ color: '#ffffff',
352
+ glow: {
353
+ gradient: {
354
+ type: 'linear',
355
+ colors: [
356
+ { stop: 0, color: '#ff6b6b' },
357
+ { stop: 1, color: '#4ecdc4' }
358
+ ]
359
+ },
360
+ intensity: 15,
361
+ opacity: 0.9
362
+ }
363
+ }, canvasBuffer);
364
+
365
+ // Gradient Highlight
366
+ await painter.createText({
367
+ text: 'Gradient Highlight',
368
+ x: 100, y: 150,
369
+ fontSize: 24,
370
+ color: '#000000',
371
+ highlight: {
372
+ gradient: {
373
+ type: 'radial',
374
+ colors: [
375
+ { stop: 0, color: '#ffd700' },
376
+ { stop: 1, color: '#ff6b6b' }
377
+ ]
378
+ },
379
+ opacity: 0.6
380
+ }
381
+ }, canvasBuffer);
382
+
383
+ // Gradient Text Decorations
384
+ await painter.createText({
385
+ text: 'Styled Decorations',
386
+ x: 100, y: 200,
387
+ fontSize: 28,
388
+ color: '#ffffff',
389
+ underline: {
390
+ gradient: {
391
+ type: 'linear',
392
+ colors: [
393
+ { stop: 0, color: '#ff6b6b' },
394
+ { stop: 1, color: '#4ecdc4' }
395
+ ]
396
+ },
397
+ width: 4
398
+ },
399
+ overline: {
400
+ gradient: {
401
+ type: 'linear',
402
+ colors: [
403
+ { stop: 0, color: '#feca57' },
404
+ { stop: 1, color: '#ff9ff3' }
405
+ ]
406
+ },
407
+ width: 3
408
+ },
409
+ strikethrough: {
410
+ gradient: {
411
+ type: 'linear',
412
+ colors: [
413
+ { stop: 0, color: '#96ceb4' },
414
+ { stop: 1, color: '#45b7d1' }
415
+ ]
416
+ },
417
+ width: 5
418
+ }
419
+ }, canvasBuffer);
420
+
421
+ // ✅ Backward Compatibility (Simple Boolean)
422
+ await painter.createText({
423
+ text: 'Simple Decorations',
424
+ x: 100, y: 250,
425
+ fontSize: 24,
426
+ color: '#ffffff',
427
+ underline: true, // Uses default color
428
+ overline: true, // Uses default color
429
+ strikethrough: true // Uses default color
430
+ }, canvasBuffer);
431
+ ```
432
+
433
+ **Gradient Support:**
434
+ - **Glow**: Gradient glow effects with intensity and opacity
435
+ - **Highlight**: Gradient background highlights
436
+ - **Underline**: Custom gradient underlines with width control
437
+ - **Overline**: Custom gradient overlines with width control
438
+ - **Strikethrough**: Custom gradient strikethrough with width control
439
+ - **Backward Compatible**: Simple `boolean` values still work
440
+
441
+ ---
442
+
443
+ ## 🎯 Real-World Examples
444
+
445
+ ### 🏢 **Business Cards & Marketing Materials**
446
+
447
+ ```typescript
448
+ // Create a professional business card
449
+ const businessCard = await painter.createCanvas({
450
+ width: 400,
451
+ height: 250,
452
+ gradientBg: {
453
+ type: 'linear',
454
+ colors: [
455
+ { color: '#2C3E50', position: 0 },
456
+ { color: '#34495E', position: 1 }
457
+ ],
458
+ direction: { x1: 0, y1: 0, x2: 400, y2: 250 }
459
+ },
460
+ patternBg: {
461
+ type: 'dots',
462
+ color: '#FFF',
463
+ opacity: 0.1,
464
+ size: 5,
465
+ spacing: 20
466
+ }
467
+ });
468
+
469
+ // Add company logo (star shape)
470
+ const logo = await painter.createImage({
471
+ source: 'star',
472
+ x: 50,
473
+ y: 50,
474
+ width: 60,
475
+ height: 60,
476
+ fill: true,
477
+ color: '#FFD700',
478
+ shadow: { color: '#000', offsetX: 3, offsetY: 3, blur: 8 }
479
+ }, businessCard.buffer);
480
+
481
+ // Add company name
482
+ const companyText = await painter.createText({
483
+ text: 'ACME Corp',
484
+ x: 130,
485
+ y: 80,
486
+ fontSize: 24,
487
+ fontFamily: 'Arial',
488
+ bold: true,
489
+ color: '#FFF',
490
+ shadow: { color: '#000', offsetX: 2, offsetY: 2, blur: 4 }
491
+ }, logo);
492
+
493
+ // Add contact info
494
+ const contactText = await painter.createText({
495
+ text: 'john@acme.com\n+1 (555) 123-4567',
496
+ x: 50,
497
+ y: 150,
498
+ fontSize: 14,
499
+ fontFamily: 'Arial',
500
+ color: '#BDC3C7',
501
+ lineHeight: 1.5
502
+ }, companyText);
503
+ ```
504
+
505
+ ### 🎮 **Game UI Elements**
506
+
507
+ ```typescript
508
+ // Create a game button
509
+ const gameButton = await painter.createCanvas({
510
+ width: 200,
511
+ height: 60,
512
+ gradientBg: {
513
+ type: 'linear',
514
+ colors: [
515
+ { color: '#FF6B6B', position: 0 },
516
+ { color: '#FF1744', position: 1 }
517
+ ],
518
+ direction: { x1: 0, y1: 0, x2: 200, y2: 60 }
519
+ },
520
+ shadow: {
521
+ color: '#000',
522
+ offsetX: 5,
523
+ offsetY: 5,
524
+ blur: 15
525
+ },
526
+ borderRadius: 30
527
+ });
528
+
529
+ // Add button text with glow effect
530
+ const buttonText = await painter.createText({
531
+ text: 'PLAY NOW',
532
+ x: 100,
533
+ y: 35,
534
+ fontSize: 20,
535
+ fontFamily: 'Arial',
536
+ bold: true,
537
+ color: '#FFF',
538
+ textAlign: 'center',
539
+ textBaseline: 'middle',
540
+ glow: {
541
+ color: '#FFD700',
542
+ intensity: 0.6,
543
+ opacity: 0.8
544
+ },
545
+ shadow: {
546
+ color: '#000',
547
+ offsetX: 2,
548
+ offsetY: 2,
549
+ blur: 4
550
+ }
551
+ }, gameButton.buffer);
552
+ ```
553
+
554
+ ---
555
+
556
+ ## 📚 API Reference
557
+
558
+ ### Core Methods
559
+
560
+ | Method | Description | Parameters |
561
+ |--------|-------------|------------|
562
+ | `createCanvas()` | Create a new canvas with background | `CanvasConfig` |
563
+ | `createImage()` | Add shapes/images to canvas | `ImageProperties \| ImageProperties[]` |
564
+ | `createText()` | Add text to canvas | `TextProperties \| TextProperties[]` |
565
+ | `createChart()` | Generate charts | `ChartConfig` |
566
+ | `createGIF()` | Create animated GIFs | `GIFConfig` |
567
+
568
+ ### 🔄 **Flexible Parameters**
569
+
570
+ Both `createImage()` and `createText()` methods accept:
571
+ - **Single Object**: `ImageProperties` or `TextProperties`
572
+ - **Array of Objects**: `ImageProperties[]` or `TextProperties[]`
573
+
574
+ This allows you to add multiple elements in one call for better performance and cleaner code.
575
+
576
+ ### Shape Types
577
+
578
+ - `rectangle` - Standard rectangle
579
+ - `square` - Perfect square
580
+ - `circle` - Perfect circle
581
+ - `triangle` - Equilateral triangle
582
+ - `trapezium` - Trapezoid shape
583
+ - `star` - 5-pointed star
584
+ - `heart` - Heart shape with bezier curves
585
+ - `polygon` - Custom polygon
586
+
587
+ ### Pattern Types
588
+
589
+ - `grid` - Grid pattern
590
+ - `dots` - Dot pattern
591
+ - `diagonal` - Diagonal lines
592
+ - `stripes` - Horizontal/vertical stripes
593
+ - `waves` - Wave pattern
594
+ - `crosses` - Cross pattern
595
+ - `hexagons` - Hexagonal pattern
596
+ - `checkerboard` - Checkerboard pattern
597
+ - `diamonds` - Diamond pattern
598
+ - `triangles` - Triangle pattern
599
+ - `stars` - Star pattern
600
+ - `polka` - Polka dot pattern
601
+ - `custom` - Custom image pattern
602
+
603
+ ---
604
+
605
+ ## 🤝 Contributing
606
+
607
+ We welcome contributions! Here's how you can help:
608
+
609
+ 1. **Report Bugs**: Found a bug? Open an issue with detailed information
610
+ 2. **Feature Requests**: Have an idea? We'd love to hear it!
611
+ 3. **Code Contributions**: Submit pull requests for improvements
612
+ 4. **Documentation**: Help improve our docs and examples
613
+
614
+ ### Development Setup
615
+
616
+ ```bash
617
+ # Clone the repository
618
+ git clone https://github.com/your-username/apexify.git
619
+
620
+ # Install dependencies
621
+ npm install
622
+
623
+ # Run tests
624
+ npm test
625
+
626
+ # Build the project
627
+ npm run build
628
+ ```
629
+
630
+ ---
631
+
632
+ ## 📞 Support & Community
633
+
634
+ <div align="center">
635
+
636
+ ### Join Our Discord Community
637
+
638
+ [![Jedi Studio](https://img.shields.io/badge/Discord-Jedi%20Studio-7289DA?style=for-the-badge&logo=discord)](https://discord.gg/CS2NRSPyze)
639
+ [![FresedGPT](https://img.shields.io/badge/Discord-FresedGPT-7289DA?style=for-the-badge&logo=discord)](https://discord.gg/94qUZWhwFE)
640
+ [![ElectronHub](https://img.shields.io/badge/Discord-ElectronHub-7289DA?style=for-the-badge&logo=discord)](https://discord.gg/83XcjD8vgW)
641
+
642
+ ### Documentation & Resources
643
+
644
+ [![Documentation](https://img.shields.io/badge/Docs-Apexify.js-blue?style=for-the-badge)](http://apexifyjs.jedi-studio.com)
645
+ [![Support Server](https://img.shields.io/badge/Support-Discord-7289DA?style=for-the-badge&logo=discord)](https://discord.gg/mDyXV9hzXw)
646
+
647
+ </div>
648
+
649
+ ---
650
+
651
+ ## 📄 License
652
+
653
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
654
+
655
+ ---
656
+
657
+ ## 🙏 Acknowledgments
658
+
659
+ - **@napi-rs/canvas** - High-performance canvas rendering
660
+ - **Sharp** - Professional image processing
661
+ - **Jimp** - JavaScript image manipulation
662
+ - **TypeScript** - Type-safe development
663
+
664
+ ---
665
+
666
+ <div align="center">
667
+
668
+ **Made with ❤️ by [Jedi Studio](https://discord.gg/CS2NRSPyze)**
669
+
670
+ *Create stunning visuals with ApexPainter - The ultimate canvas library for Node.js*
671
+
672
+ </div>