59 lines
1.7 KiB
Plaintext
59 lines
1.7 KiB
Plaintext
%module{Slic3r::XS};
|
|
|
|
%{
|
|
#include <myinit.h>
|
|
#include "ExPolygonCollection.hpp"
|
|
%}
|
|
|
|
%name{Slic3r::ExPolygon::Collection} class ExPolygonCollection {
|
|
~ExPolygonCollection();
|
|
ExPolygonCollection* clone()
|
|
%code{% const char* CLASS = "Slic3r::ExPolygon::Collection"; RETVAL = new ExPolygonCollection(*THIS); %};
|
|
void clear()
|
|
%code{% THIS->expolygons.clear(); %};
|
|
void scale(double factor);
|
|
void translate(double x, double y);
|
|
void rotate(double angle, Point* center);
|
|
%{
|
|
|
|
ExPolygonCollection*
|
|
ExPolygonCollection::new(...)
|
|
CODE:
|
|
RETVAL = new ExPolygonCollection ();
|
|
// ST(0) is class name, others are expolygons
|
|
RETVAL->expolygons.resize(items-1);
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
if (sv_isobject(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PVMG)) {
|
|
// a XS ExPolygon was supplied
|
|
RETVAL->expolygons[i-1] = *(ExPolygon *)SvIV((SV*)SvRV( ST(i) ));
|
|
} else {
|
|
// a Perl arrayref was supplied
|
|
perl2expolygon(ST(i), RETVAL->expolygons[i-1]);
|
|
}
|
|
}
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
SV*
|
|
ExPolygonCollection::arrayref()
|
|
CODE:
|
|
AV* av = newAV();
|
|
av_fill(av, THIS->expolygons.size()-1);
|
|
int i = 0;
|
|
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
|
av_store(av, i++, expolygon2perl(*it));
|
|
}
|
|
RETVAL = newRV_noinc((SV*)av);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
void
|
|
ExPolygonCollection::append(...)
|
|
CODE:
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
THIS->expolygons.push_back(*(ExPolygon *)SvIV((SV*)SvRV( ST(i) )));
|
|
}
|
|
|
|
%}
|
|
};
|