aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/include
diff options
context:
space:
mode:
Diffstat (limited to 'svg-flatten/include')
-rw-r--r--svg-flatten/include/geom2d.hpp27
-rw-r--r--svg-flatten/include/gerbolyze.hpp1
2 files changed, 20 insertions, 8 deletions
diff --git a/svg-flatten/include/geom2d.hpp b/svg-flatten/include/geom2d.hpp
index 6a52d0b..4fafd80 100644
--- a/svg-flatten/include/geom2d.hpp
+++ b/svg-flatten/include/geom2d.hpp
@@ -143,17 +143,28 @@ namespace gerbolyze {
/* Transform given clipper paths */
void transform_paths(ClipperLib::Paths &paths) {
for (auto &p : paths) {
- std::transform(p.begin(), p.end(), p.begin(),
- [this](ClipperLib::IntPoint p) -> ClipperLib::IntPoint {
- d2p out(this->doc2phys(d2p{p.X / clipper_scale, p.Y / clipper_scale}));
- return {
- (ClipperLib::cInt)round(out[0] * clipper_scale),
- (ClipperLib::cInt)round(out[1] * clipper_scale)
- };
- });
+ transform_clipper_path(p);
}
}
+ void transform_clipper_path(ClipperLib::Path &path) {
+ std::transform(path.begin(), path.end(), path.begin(),
+ [this](ClipperLib::IntPoint p) -> ClipperLib::IntPoint {
+ d2p out(this->doc2phys(d2p{p.X / clipper_scale, p.Y / clipper_scale}));
+ return {
+ (ClipperLib::cInt)round(out[0] * clipper_scale),
+ (ClipperLib::cInt)round(out[1] * clipper_scale)
+ };
+ });
+ }
+
+ void transform_polygon(Polygon &poly) {
+ std::transform(poly.begin(), poly.end(), poly.begin(),
+ [this](d2p p) -> d2p {
+ return this->doc2phys(d2p{p[0], p[1]});
+ });
+ }
+
string dbg_str() {
ostringstream os;
os << "xform2d< " << setw(5);
diff --git a/svg-flatten/include/gerbolyze.hpp b/svg-flatten/include/gerbolyze.hpp
index cd837ba..9de5572 100644
--- a/svg-flatten/include/gerbolyze.hpp
+++ b/svg-flatten/include/gerbolyze.hpp
@@ -197,6 +197,7 @@ namespace gerbolyze {
VectorizerSelectorizer &m_vec_sel;
bool outline_mode = false;
bool flip_color_interpretation = false;
+ bool pattern_complete_tiles_only = false;
};
class RenderContext {