forked from Embroidermodder/libembroidery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathembroidery.h
686 lines (604 loc) · 21.9 KB
/
embroidery.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
#ifndef LIBEMBROIDERY_HEADER__
#define LIBEMBROIDERY_HEADER__
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/* MACROS
*****************************************************************************/
/* When building a shared library,
* use the proper export keyword depending on the compiler */
#define EMB_PUBLIC
#if defined(LIBEMBROIDERY_SHARED)
#undef EMB_PUBLIC
#if defined(__WIN32__) || defined(WIN32)
#define EMB_PUBLIC __declspec(dllexport)
#else
#define EMB_PUBLIC __attribute__ ((visibility("default")))
#endif
#endif
#ifdef ARDUINO
#include "utility/ino-logging.h"
#include "utility/ino-file.h"
#else
typedef struct EmbFile_
{
FILE* file;
} EmbFile;
#endif /* ARDUINO */
#include "hashtable.h"
/* Machine codes for stitch flags */
#define NORMAL 0 /* stitch to (x, y) */
#define JUMP 1 /* move to (x, y) */
#define TRIM 2 /* trim + move to (x, y) */
#define STOP 4 /* pause machine for thread change */
#define SEQUIN 8 /* sequin */
#define END 16 /* end of program */
#define CHUNK_SIZE 128
/* Format identifiers */
#define EMB_FORMAT_100 0
#define EMB_FORMAT_10O 1
#define EMB_FORMAT_ART 2
#define EMB_FORMAT_BMC 3
#define EMB_FORMAT_BRO 4
#define EMB_FORMAT_CND 5
#define EMB_FORMAT_COL 6
#define EMB_FORMAT_CSD 7
#define EMB_FORMAT_CSV 8
#define EMB_FORMAT_DAT 9
#define EMB_FORMAT_DEM 10
#define EMB_FORMAT_DSB 11
#define EMB_FORMAT_DST 12
#define EMB_FORMAT_DSZ 13
#define EMB_FORMAT_DXF 14
#define EMB_FORMAT_EDR 15
#define EMB_FORMAT_EMD 16
#define EMB_FORMAT_EXP 17
#define EMB_FORMAT_EXY 18
#define EMB_FORMAT_EYS 19
#define EMB_FORMAT_FXY 20
#define EMB_FORMAT_GC 21
#define EMB_FORMAT_GNC 22
#define EMB_FORMAT_GT 23
#define EMB_FORMAT_HUS 24
#define EMB_FORMAT_INB 25
#define EMB_FORMAT_INF 26
#define EMB_FORMAT_JEF 27
#define EMB_FORMAT_KSM 28
#define EMB_FORMAT_MAX 29
#define EMB_FORMAT_MIT 30
#define EMB_FORMAT_NEW 31
#define EMB_FORMAT_OFM 32
#define EMB_FORMAT_PCD 33
#define EMB_FORMAT_PCM 34
#define EMB_FORMAT_PCQ 35
#define EMB_FORMAT_PCS 36
#define EMB_FORMAT_PEC 37
#define EMB_FORMAT_PEL 38
#define EMB_FORMAT_PEM 39
#define EMB_FORMAT_PES 40
#define EMB_FORMAT_PHB 41
#define EMB_FORMAT_PHC 42
#define EMB_FORMAT_PLT 43
#define EMB_FORMAT_RGB 44
#define EMB_FORMAT_SEW 45
#define EMB_FORMAT_SHV 46
#define EMB_FORMAT_SST 47
#define EMB_FORMAT_STX 48
#define EMB_FORMAT_SVG 49
#define EMB_FORMAT_T01 50
#define EMB_FORMAT_T09 51
#define EMB_FORMAT_TAP 52
#define EMB_FORMAT_THR 53
#define EMB_FORMAT_TXT 54
#define EMB_FORMAT_U00 55
#define EMB_FORMAT_U01 56
#define EMB_FORMAT_VIP 57
#define EMB_FORMAT_VP3 58
#define EMB_FORMAT_XXX 59
#define EMB_FORMAT_ZSK 60
/* Thread color */
#define Arc_Polyester 0
#define Arc_Rayon 1
#define CoatsAndClark_Rayon 2
#define Exquisite_Polyester 3
#define Fufu_Polyester 4
#define Fufu_Rayon 5
#define Hemingworth_Polyester 6
#define Isacord_Polyester 7
#define Isafil_Rayon 8
#define Marathon_Polyester 9
#define Marathon_Rayon 10
#define Madeira_Polyester 11
#define Madeira_Rayon 12
#define Metro_Polyester 13
#define Pantone 14
#define RobisonAnton_Polyester 15
#define RobisonAnton_Rayon 16
#define Sigma_Polyester 17
#define Sulky_Rayon 18
#define ThreadArt_Rayon 19
#define ThreadArt_Polyester 20
#define ThreaDelight_Polyester 21
#define Z102_Isacord_Polyester 22
#define SVG_Colors 23
#define EMB_ARC 0
#define EMB_CIRCLE 1
#define EMB_ELLIPSE 2
#define EMB_FLAG 3
#define EMB_LINE 4
#define EMB_PATH 5
#define EMB_POINT 6
#define EMB_POLYGON 7
#define EMB_POLYLINE 8
#define EMB_RECT 9
#define EMB_SPLINE 10
#define EMB_STITCH 11
#define EMB_THREAD 12
#define EMB_VECTOR 13
#define EMBFORMAT_UNSUPPORTED 0
#define EMBFORMAT_STITCHONLY 1
#define EMBFORMAT_OBJECTONLY 2
#define EMBFORMAT_STCHANDOBJ 3 /* binary operation: 1+2=3 */
/* STRUCTS
*****************************************************************************/
typedef struct EmbTime_
{
unsigned int year;
unsigned int month;
unsigned int day;
unsigned int hour;
unsigned int minute;
unsigned int second;
} EmbTime;
/* double-indirection file allocation table references */
typedef struct _bcf_file_difat
{
unsigned int fatSectorCount;
unsigned int fatSectorEntries[109];
unsigned int sectorSize;
} bcf_file_difat;
typedef struct _bcf_file_fat
{
int fatEntryCount;
unsigned int fatEntries[255]; /* maybe make this dynamic */
unsigned int numberOfEntriesInFatSector;
} bcf_file_fat;
typedef struct _bcf_directory_entry
{
char directoryEntryName[32];
unsigned short directoryEntryNameLength;
unsigned char objectType;
unsigned char colorFlag;
unsigned int leftSiblingId;
unsigned int rightSiblingId;
unsigned int childId;
unsigned char CLSID[16];
unsigned int stateBits;
EmbTime creationTime;
EmbTime modifiedTime;
unsigned int startingSectorLocation;
unsigned long streamSize; /* should be long long but in our case we shouldn't need it, and hard to support on c89 cross platform */
unsigned int streamSizeHigh; /* store the high int of streamsize */
struct _bcf_directory_entry* next;
} bcf_directory_entry;
typedef struct _bcf_directory
{
bcf_directory_entry* dirEntries;
unsigned int maxNumberOfDirectoryEntries;
/* TODO: possibly add a directory tree in the future */
} bcf_directory;
typedef struct _bcf_file_header
{
unsigned char signature[8];
unsigned char CLSID[16]; /* TODO: this should be a separate type */
unsigned short minorVersion;
unsigned short majorVersion;
unsigned short byteOrder;
unsigned short sectorShift;
unsigned short miniSectorShift;
unsigned short reserved1;
unsigned int reserved2;
unsigned int numberOfDirectorySectors;
unsigned int numberOfFATSectors;
unsigned int firstDirectorySectorLocation;
unsigned int transactionSignatureNumber;
unsigned int miniStreamCutoffSize;
unsigned int firstMiniFATSectorLocation;
unsigned int numberOfMiniFatSectors;
unsigned int firstDifatSectorLocation;
unsigned int numberOfDifatSectors;
} bcf_file_header;
typedef struct _bcf_file
{
bcf_file_header header; /*! The header for the CompoundFile */
bcf_file_difat* difat; /*! The "Double Indirect FAT" for the CompoundFile */
bcf_file_fat* fat; /*! The File Allocation Table for the Compound File */
bcf_directory* directory; /*! The directory for the CompoundFile */
} bcf_file;
/**
* EmbColor uses the light primaries: red, green, blue in that order.
*/
typedef struct EmbColor_
{
unsigned char r;
unsigned char g;
unsigned char b;
} EmbColor;
/**
* The basic type to represent points absolutely or represent directions.
*
* Positive y is up, units are in mm.
*/
typedef struct EmbVector_
{
double x;
double y;
} EmbVector;
typedef struct EmbArray_ EmbArray;
/**
* Does it make sense to have lineType for a point?
*/
/**
* The "Object" typedefs are remarkably similar throughout,
* could we have a single GeometryObject type that mimics the
* .
*/
typedef struct EmbPointObject_
{
EmbVector point;
int lineType;
EmbColor color;
} EmbPointObject;
/**
* TODO: documentation.
*/
typedef struct EmbLine_
{
EmbVector start;
EmbVector end;
} EmbLine;
/**
* TODO: documentation.
*/
typedef struct EmbLineObject_
{
EmbLine line;
int lineType;
EmbColor color;
} EmbLineObject;
/**
* Is this used anywhere?
*/
typedef struct EmbLayer_
{
EmbColor color;
const char* name;
} EmbLayer;
/**
*
*/
typedef struct EmbPathObject_
{
EmbArray* pointList;
EmbArray* flagList;
int lineType;
EmbColor color;
} EmbPathObject;
typedef struct EmbStitch_
{
int flags; /* uses codes defined above */
double x; /* absolute position (not relative) */
double y; /* positive is up, units are in mm */
int color; /* color number for this stitch */ /* TODO: this should be called colorIndex since it is not an EmbColor */
} EmbStitch;
/**
* Improving the size of the stored data for embedded systems.
*
* Store thread colors as:
* "\xFF\xFF\xFF" "1001" "Pure White"
*
* Since the color is always three characters, it doesn't need to be
* stored with a spacing character. No manufacturer code takes more than
* 4 chars in the current set, so we can pad them all to 4 char.
*
* Then zero termination sorts out the variable length of the string.
*
* That means that we have a single string for each data.
*
* This requires reworking the embThread functions.
*
* It also removes the need for either struct.
*/
typedef struct EmbThread_
{
EmbColor color;
const char* description;
const char* catalogNumber;
} EmbThread;
/**
* TODO: this should be merged with the EmbThread.
*/
typedef struct thread_color_ {
const char *name;
unsigned char r;
unsigned char g;
unsigned char b;
short manufacturer_code;
} thread_color;
typedef struct EmbHoop_
{
double width;
double height;
} EmbHoop;
typedef EmbHashTable EmbHash;
typedef struct EmbEllipse_
{
EmbVector center;
EmbVector radius;
} EmbEllipse;
typedef struct EmbArc_
{
EmbVector start; /* absolute position (not relative) */
EmbVector mid; /* absolute position (not relative) */
EmbVector end; /* absolute position (not relative) */
} EmbArc;
typedef struct EmbArcObject_
{
EmbArc arc;
int lineType;
EmbColor color;
} EmbArcObject;
typedef struct EmbRect_
{
double top;
double left;
double bottom;
double right;
} EmbRect;
typedef struct EmbCircle_
{
EmbVector center;
double radius;
} EmbCircle;
typedef struct EmbCircleObject_
{
EmbCircle circle;
int lineType;
EmbColor color;
int count;
int length;
} EmbCircleObject;
typedef struct EmbRectObject_
{
EmbRect rect;
double rotation;
double radius;
int lineType;
EmbColor color;
} EmbRectObject;
typedef struct EmbPolygonObject_
{
EmbArray* pointList;
int lineType;
EmbColor color;
} EmbPolygonObject;
typedef struct EmbSatinOutline_
{
int length;
EmbArray* side1;
EmbArray* side2;
} EmbSatinOutline;
typedef struct EmbEllipseObject_
{
EmbEllipse ellipse;
double rotation;
int lineType;
EmbColor color;
} EmbEllipseObject;
typedef struct EmbPolylineObject_
{
EmbArray* pointList;
int lineType;
EmbColor color;
} EmbPolylineObject;
typedef struct EmbSettings_ {
unsigned int dstJumpsPerTrim;
EmbVector home;
} EmbSettings;
typedef struct EmbBezier_ {
EmbVector start;
EmbVector control1;
EmbVector control2;
EmbVector end;
} EmbBezier;
typedef struct EmbSplineObject_ {
EmbBezier bezier;
struct EmbSplineObject_* next;
int lineType;
EmbColor color;
} EmbSplineObject;
/**
* Only one of the pointers is used at a time so this should be a union.
*/
struct EmbArray_ {
EmbArcObject *arc;
EmbCircleObject *circle;
EmbColor *color;
EmbEllipseObject *ellipse;
int *flag;
EmbPathObject **path;
EmbPointObject *point;
EmbLineObject *line;
EmbPolygonObject **polygon;
EmbPolylineObject **polyline;
EmbRectObject *rect;
EmbSplineObject *spline;
EmbStitch *stitch;
EmbThread *thread;
EmbVector *vector;
int count;
int length;
int type;
};
typedef struct EmbPattern_
{
EmbSettings settings;
EmbHoop hoop;
EmbArray* stitchList;
EmbArray* threads;
EmbArray* arcs;
EmbArray* circles;
EmbArray* ellipses;
EmbArray* lines;
EmbArray* paths;
EmbArray* points;
EmbArray* polygons;
EmbArray* polylines;
EmbArray* rects;
EmbArray* splines;
int currentColorIndex;
EmbVector lastPosition;
} EmbPattern;
typedef struct EmbFormatList_
{
char *extension;
char *description;
char reader;
char writer;
int type;
} EmbFormatList;
/* Function Declarations
*****************************************************************************/
EMB_PUBLIC EmbArray* embArray_create(int type);
EMB_PUBLIC int embArray_resize(EmbArray *g);
EMB_PUBLIC int embArray_addArc(EmbArray* g, EmbArc arc, int lineType, EmbColor color);
EMB_PUBLIC int embArray_addCircle(EmbArray* g, EmbCircle circle, int lineType, EmbColor color);
EMB_PUBLIC int embArray_addEllipse(EmbArray* g, EmbEllipse circle, double rotation, int lineType, EmbColor color);
EMB_PUBLIC int embArray_addFlag(EmbArray* g, int flag);
EMB_PUBLIC int embArray_addLine(EmbArray* g, EmbLineObject line);
EMB_PUBLIC int embArray_addRect(EmbArray* g, EmbRect rect, int lineType, EmbColor color);
EMB_PUBLIC int embArray_addPath(EmbArray* g, EmbPathObject *p);
EMB_PUBLIC int embArray_addPoint(EmbArray* g, EmbPointObject *p);
EMB_PUBLIC int embArray_addPolygon(EmbArray* g, EmbPolygonObject *p);
EMB_PUBLIC int embArray_addPolyline(EmbArray* g, EmbPolylineObject *p);
EMB_PUBLIC int embArray_addStitch(EmbArray* g, EmbStitch st);
EMB_PUBLIC int embArray_addThread(EmbArray* g, EmbThread p);
EMB_PUBLIC int embArray_addVector(EmbArray* g, EmbVector);
EMB_PUBLIC void embArray_free(EmbArray* p);
EMB_PUBLIC EmbLine embLine_make(EmbVector start, EmbVector end);
EMB_PUBLIC void embLine_normalVector(EmbLine line, EmbVector* result, int clockwise);
EMB_PUBLIC unsigned char embLine_intersectionPoint(EmbLine line1, EmbLine line2, EmbVector* result);
EMB_PUBLIC void embVector_normalize(EmbVector vector, EmbVector* result);
EMB_PUBLIC void embVector_multiply(EmbVector vector, double magnitude, EmbVector* result);
EMB_PUBLIC void embVector_add(EmbVector v1, EmbVector v2, EmbVector* result);
EMB_PUBLIC void embVector_average(EmbVector v1, EmbVector v2, EmbVector* result);
EMB_PUBLIC void embVector_subtract(EmbVector v1, EmbVector v2, EmbVector* result);
EMB_PUBLIC double embVector_distance(EmbVector v1, EmbVector v2);
EMB_PUBLIC double embVector_dot(EmbVector v1, EmbVector v2);
EMB_PUBLIC double embVector_cross(EmbVector a, EmbVector b);
EMB_PUBLIC void embVector_normalVector(EmbVector a, EmbVector *b, int clockwise);
EMB_PUBLIC void embVector_transposeProduct(EmbVector v1, EmbVector v2, EmbVector* result);
EMB_PUBLIC double embVector_getLength(EmbVector vector);
EMB_PUBLIC int embFormat_getExtension(const char* fileName, char *ending);
EMB_PUBLIC const char* embFormat_extensionFromName(const char* fileName);
EMB_PUBLIC const char* embFormat_descriptionFromName(const char* fileName);
EMB_PUBLIC char embFormat_readerStateFromName(const char* fileName);
EMB_PUBLIC char embFormat_writerStateFromName(const char* fileName);
EMB_PUBLIC int embFormat_typeFromName(const char* fileName);
EMB_PUBLIC EmbArcObject embArcObject_make(EmbVector s, EmbVector m, EmbVector e);
EMB_PUBLIC char isArcClockwise(EmbArc arc);
EMB_PUBLIC void getArcCenter(EmbArc arc, EmbVector *arcCenter);
EMB_PUBLIC char getArcDataFromBulge(double bulge, EmbArc* arc, EmbVector* arcCenter,
double* radius, double* diameter, double* chord, EmbVector* chordMid,
double* sagitta, double* apothem, double* incAngleInDegrees, char* clockwise);
EMB_PUBLIC int getCircleCircleIntersections(EmbCircle c0, EmbCircle c1, EmbVector* p3, EmbVector* p4);
EMB_PUBLIC int getCircleTangentPoints(EmbCircle c, EmbVector point, EmbVector* t0, EmbVector* t1);
EMB_PUBLIC EmbColor embColor_fromHexStr(char* val);
EMB_PUBLIC int threadColor(EmbColor *c, const char*, int brand);
EMB_PUBLIC int threadColorNum(EmbColor color, int brand);
EMB_PUBLIC const char* threadColorName(EmbColor color, int brand);
EMB_PUBLIC int embThread_findNearestColor(EmbColor color, EmbArray* colors, int mode);
EMB_PUBLIC int embThread_findNearestColor_fromThread(EmbColor color, const EmbThread* colors, int length);
EMB_PUBLIC EmbThread embThread_getRandom(void);
EMB_PUBLIC double embEllipse_diameterX(EmbEllipse ellipse);
EMB_PUBLIC double embEllipse_diameterY(EmbEllipse ellipse);
EMB_PUBLIC double embEllipse_width(EmbEllipse ellipse);
EMB_PUBLIC double embEllipse_height(EmbEllipse ellipse);
EMB_PUBLIC EmbEllipseObject embEllipseObject_make(EmbVector, EmbVector);
EMB_PUBLIC EmbFile* embFile_open(const char* fileName, const char* mode, int optional);
EMB_PUBLIC void embFile_readline(EmbFile* stream, char *, int);
EMB_PUBLIC int embFile_close(EmbFile* stream);
EMB_PUBLIC int embFile_eof(EmbFile* stream);
EMB_PUBLIC char embFile_getc(EmbFile* stream);
EMB_PUBLIC size_t embFile_read(void* ptr, size_t size, size_t nmemb, EmbFile* stream);
EMB_PUBLIC size_t embFile_write(const void* ptr, size_t size, size_t nmemb, EmbFile* stream);
EMB_PUBLIC int embFile_seek(EmbFile* stream, long offset, int origin);
EMB_PUBLIC long embFile_tell(EmbFile* stream);
EMB_PUBLIC EmbFile* embFile_tmpfile(void);
EMB_PUBLIC int embFile_putc(int ch, EmbFile* stream);
EMB_PUBLIC int embFile_puts(EmbFile* stream, char *);
EMB_PUBLIC void embFile_print(EmbFile* stream, const char*);
EMB_PUBLIC void embFile_pad(EmbFile *f, char, int);
EMB_PUBLIC int bcfFile_read(EmbFile* file, bcf_file* bcfFile);
EMB_PUBLIC EmbFile* GetFile(bcf_file* bcfFile, EmbFile* file, char* fileToFind);
EMB_PUBLIC void bcf_file_free(bcf_file* bcfFile);
EMB_PUBLIC EmbSettings embSettings_init(void);
EMB_PUBLIC EmbVector embSettings_home(EmbSettings* settings);
EMB_PUBLIC void embSettings_setHome(EmbSettings* settings, EmbVector point);
EMB_PUBLIC void embSatinOutline_generateSatinOutline(EmbArray* lines, double thickness, EmbSatinOutline* result);
EMB_PUBLIC EmbArray* embSatinOutline_renderStitches(EmbSatinOutline* result, double density);
EMB_PUBLIC double embRect_x(EmbRect rect);
EMB_PUBLIC double embRect_y(EmbRect rect);
EMB_PUBLIC double embRect_width(EmbRect rect);
EMB_PUBLIC double embRect_height(EmbRect rect);
EMB_PUBLIC void embRect_setX(EmbRect* rect, double x);
EMB_PUBLIC void embRect_setY(EmbRect* rect, double y);
EMB_PUBLIC void embRect_setWidth(EmbRect* rect, double w);
EMB_PUBLIC void embRect_setHeight(EmbRect* rect, double h);
EMB_PUBLIC void embRect_setCoords(EmbRect* rect, double x1, double y1, double x2, double y2);
EMB_PUBLIC void embRect_setRect(EmbRect* rect, double x, double y, double w, double h);
EMB_PUBLIC EmbRectObject embRectObject_make(double x, double y, double w, double h);
EMB_PUBLIC int embReaderWriter_getByFileName(const char* fileName);
EMB_PUBLIC EmbPattern* embPattern_create(void);
EMB_PUBLIC void embPattern_hideStitchesOverLength(EmbPattern* p, int length);
EMB_PUBLIC void embPattern_fixColorCount(EmbPattern* p);
EMB_PUBLIC int embPattern_addThread(EmbPattern* p, EmbThread thread);
EMB_PUBLIC void embPattern_addStitchAbs(EmbPattern* p, double x, double y, int flags, int isAutoColorIndex);
EMB_PUBLIC void embPattern_addStitchRel(EmbPattern* p, double dx, double dy, int flags, int isAutoColorIndex);
EMB_PUBLIC void embPattern_changeColor(EmbPattern* p, int index);
EMB_PUBLIC void embPattern_free(EmbPattern* p);
EMB_PUBLIC void embPattern_scale(EmbPattern* p, double scale);
EMB_PUBLIC EmbRect embPattern_calcBoundingBox(EmbPattern* p);
EMB_PUBLIC void embPattern_flipHorizontal(EmbPattern* p);
EMB_PUBLIC void embPattern_flipVertical(EmbPattern* p);
EMB_PUBLIC void embPattern_flip(EmbPattern* p, int horz, int vert);
EMB_PUBLIC void embPattern_combineJumpStitches(EmbPattern* p);
EMB_PUBLIC void embPattern_correctForMaxStitchLength(EmbPattern* p, double maxStitchLength, double maxJumpLength);
EMB_PUBLIC void embPattern_center(EmbPattern* p);
EMB_PUBLIC void embPattern_loadExternalColorFile(EmbPattern* p, const char* fileName);
EMB_PUBLIC void embPattern_end(EmbPattern* p);
EMB_PUBLIC int embPattern_write(EmbPattern* pattern, const char *function, int);
EMB_PUBLIC int embPattern_read(EmbPattern* pattern, const char *function, int);
EMB_PUBLIC int embPattern_writeAuto(EmbPattern* pattern, const char *function);
EMB_PUBLIC int embPattern_readAuto(EmbPattern* pattern, const char *function);
EMB_PUBLIC void embPattern_addCircleObjectAbs(EmbPattern* p, double cx, double cy, double r);
EMB_PUBLIC void embPattern_addEllipseObjectAbs(EmbPattern* p, double cx, double cy, double rx, double ry); /* TODO: ellipse rotation */
EMB_PUBLIC void embPattern_addLineObjectAbs(EmbPattern* p, double x1, double y1, double x2, double y2);
EMB_PUBLIC void embPattern_addPathObjectAbs(EmbPattern* p, EmbPathObject* obj);
EMB_PUBLIC void embPattern_addPointObjectAbs(EmbPattern* p, double x, double y);
EMB_PUBLIC void embPattern_addPolygonObjectAbs(EmbPattern* p, EmbPolygonObject* obj);
EMB_PUBLIC void embPattern_addPolylineObjectAbs(EmbPattern* p, EmbPolylineObject* obj);
EMB_PUBLIC void embPattern_addRectObjectAbs(EmbPattern* p, double x, double y, double w, double h);
EMB_PUBLIC void embPattern_copyStitchListToPolylines(EmbPattern* pattern);
EMB_PUBLIC void embPattern_copyPolylinesToStitchList(EmbPattern* pattern);
EMB_PUBLIC void embPattern_moveStitchListToPolylines(EmbPattern* pattern);
EMB_PUBLIC void embPattern_movePolylinesToStitchList(EmbPattern* pattern);
/* NON-MACRO CONSTANTS
******************************************************************************/
EMB_PUBLIC extern const EmbFormatList formatTable[];
EMB_PUBLIC extern int numberOfFormats;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LIBEMBROIDERY_HEADER__ */