48 lines
1.1 KiB
Plaintext
48 lines
1.1 KiB
Plaintext
%module{Slic3r::XS};
|
|
|
|
%{
|
|
#include <myinit.h>
|
|
#include "Polyline.hpp"
|
|
%}
|
|
|
|
%name{Slic3r::Polyline::XS} class Polyline {
|
|
~Polyline();
|
|
Polyline* clone()
|
|
%code{% const char* CLASS = "Slic3r::Polyline::XS"; RETVAL = new Polyline(*THIS); %};
|
|
SV* arrayref()
|
|
%code{% RETVAL = THIS->to_SV(true, false); %};
|
|
SV* arrayref_pp()
|
|
%code{% RETVAL = THIS->to_SV(true, true); %};
|
|
void pop_back()
|
|
%code{% THIS->points.pop_back(); %};
|
|
void reverse();
|
|
%{
|
|
|
|
Polyline*
|
|
Polyline::new(...)
|
|
CODE:
|
|
RETVAL = new Polyline ();
|
|
// ST(0) is class name, ST(1) is first point
|
|
RETVAL->points.resize(items-1);
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
perl2point(ST(i), RETVAL->points[i-1]);
|
|
}
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
void
|
|
Polyline::append(...)
|
|
CODE:
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
Point p;
|
|
if (sv_isobject(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PVMG)) {
|
|
p = *(Point*)SvIV((SV*)SvRV( ST(i) ));
|
|
} else {
|
|
perl2point(ST(i), p);
|
|
}
|
|
THIS->points.push_back(p);
|
|
}
|
|
|
|
%}
|
|
};
|