mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
Polyline->lines
This commit is contained in:
@@ -23,6 +23,7 @@ class Line
|
||||
void from_SV(SV* line_sv);
|
||||
void from_SV_check(SV* line_sv);
|
||||
SV* to_SV();
|
||||
SV* to_SV_ref();
|
||||
SV* to_SV_pureperl();
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
@@ -93,6 +94,13 @@ Line::to_SV() {
|
||||
return newRV_noinc((SV*)av);
|
||||
}
|
||||
|
||||
SV*
|
||||
Line::to_SV_ref() {
|
||||
SV* sv = newSV(0);
|
||||
sv_setref_pv( sv, "Slic3r::Line", new Line(*this) );
|
||||
return sv;
|
||||
}
|
||||
|
||||
SV*
|
||||
Line::to_SV_pureperl() {
|
||||
AV* av = newAV();
|
||||
@@ -102,6 +110,19 @@ Line::to_SV_pureperl() {
|
||||
return newRV_noinc((SV*)av);
|
||||
}
|
||||
|
||||
SV*
|
||||
lines2perl(pTHX_ Lines& lines)
|
||||
{
|
||||
AV* av = newAV();
|
||||
av_extend(av, lines.size()-1);
|
||||
int i = 0;
|
||||
for (Lines::iterator it = lines.begin(); it != lines.end(); ++it) {
|
||||
SV* sv = (*it).to_SV_ref();
|
||||
av_store(av, i++, sv);
|
||||
}
|
||||
return (SV*)newRV_noinc((SV*)av);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user