1
4
5#ifndef POTRACELIB_H
6#define POTRACELIB_H
7
8# if defined(LUAMETATEX_USE_MIMALLOC)
9
10 # include "libraries/mimalloc/include/mimalloc-override.h"
11
12# endif
13
14
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21
22
23
24
25#define POTRACE_TURNPOLICY_BLACK 0
26#define POTRACE_TURNPOLICY_WHITE 1
27#define POTRACE_TURNPOLICY_LEFT 2
28#define POTRACE_TURNPOLICY_RIGHT 3
29#define POTRACE_TURNPOLICY_MINORITY 4
30#define POTRACE_TURNPOLICY_MAJORITY 5
31#define POTRACE_TURNPOLICY_RANDOM 6
32
33
34struct potrace_progress_s {
35 void (*callback)(double progress, void *privdata);
36 void *data;
37 double min, max;
38 double epsilon;
39};
40typedef struct potrace_progress_s potrace_progress_t;
41
42
43struct potrace_param_s {
44 int turdsize;
45 int turnpolicy;
46 double alphamax;
47 int opticurve;
48 double opttolerance;
49 potrace_progress_t progress;
50};
51typedef struct potrace_param_s potrace_param_t;
52
53
54
55
56
57typedef unsigned long potrace_word;
58
59
63struct potrace_bitmap_s {
64 int w, h;
65 int dy;
66 potrace_word *map;
67};
68typedef struct potrace_bitmap_s potrace_bitmap_t;
69
70
71
72
73
74struct potrace_dpoint_s {
75 double x, y;
76};
77typedef struct potrace_dpoint_s potrace_dpoint_t;
78
79
80#define POTRACE_CURVETO 1
81#define POTRACE_CORNER 2
82
83
84struct potrace_curve_s {
85 int n;
86 int *tag;
87 potrace_dpoint_t (*c)[3];
89};
90typedef struct potrace_curve_s potrace_curve_t;
91
92
93struct potrace_path_s {
94 int area;
95 int sign;
96 potrace_curve_t curve;
97
98 struct potrace_path_s *next;
99
100 struct potrace_path_s *childlist;
101 struct potrace_path_s *sibling;
102
103 struct potrace_privpath_s *priv;
104};
105typedef struct potrace_path_s potrace_path_t;
106
107
108
109
110#define POTRACE_STATUS_OK 0
111#define POTRACE_STATUS_INCOMPLETE 1
112
113struct potrace_state_s {
114 int status;
115 potrace_path_t *plist;
116
117 struct potrace_privstate_s *priv;
118};
119typedef struct potrace_state_s potrace_state_t;
120
121
122
123
124
125potrace_param_t *potrace_param_default(void);
126
127
128void potrace_param_free(potrace_param_t *p);
129
130
131potrace_state_t *potrace_trace(const potrace_param_t *param,
132 const potrace_bitmap_t *bm);
133
134
135void potrace_state_free(potrace_state_t *st);
136
137
139const char *potrace_version(void);
140
141#ifdef __cplusplus
142}
143#endif
144
145#endif
146 |