forked from alex85k/Perl-GPCPolygon-XS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PolygonXS.xs
69 lines (49 loc) · 1 KB
/
PolygonXS.xs
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
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include <functions.h>
MODULE = Math::Geometry::Planar::GPC::PolygonXS PACKAGE = Math::Geometry::Planar::GPC::PolygonXS
SV*
new(class)
char* class;
void add_polygon(obj, pg, hole);
SV* obj;
SV* pg;
int hole;
void DESTROY(obj);
SV* obj;
int from_file(obj, filename, want_hole);
SV* obj;
char* filename;
int want_hole;
void to_file(obj, filename, want_hole);
SV* obj;
char* filename;
int want_hole;
SV* clip_to(obj, clp, action);
SV* obj;
SV* clp;
char* action
void get_polygons(obj);
SV* obj
INIT:
int c;
gpc_polygon* p;
PPCODE:
p = (gpc_polygon*) SvIV(SvRV(obj));
PUSHMARK(SP);
if(p->num_contours < 1) {
PUTBACK;
return;
}
for(c = 0; c < p->num_contours; c++) {
XPUSHs(newRV_noinc((SV*) vertex_list_to_pts(&(p->contour[c]))));
}
#void pts_to_vertex_list(pg, vl);
#SV* pg;
#gpc_vertex_list* vl;
#AV* vertex_list_to_pts(vl);
#gpc_vertex_list* vl;
#void gpc_free_polygon2(p);
#gpc_polygon *p;