diff options
author | jaseg <git@jaseg.de> | 2022-06-19 21:25:10 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2022-06-19 21:25:10 +0200 |
commit | 446c5e59019501a8401410a4e9bb3495b155e660 (patch) | |
tree | dc32ed9bbeac53b2cae74c6fa334b585886fe8be /svg-flatten | |
parent | 5f33356f330465907cb9ec69fb4543c271f3bea4 (diff) | |
download | gerbolyze-446c5e59019501a8401410a4e9bb3495b155e660.tar.gz gerbolyze-446c5e59019501a8401410a4e9bb3495b155e660.tar.bz2 gerbolyze-446c5e59019501a8401410a4e9bb3495b155e660.zip |
svg-flatten: fix patterns with offset clip path
Diffstat (limited to 'svg-flatten')
-rw-r--r-- | svg-flatten/src/svg_doc.cpp | 8 | ||||
-rw-r--r-- | svg-flatten/src/svg_pattern.cpp | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/svg-flatten/src/svg_doc.cpp b/svg-flatten/src/svg_doc.cpp index b1c253a..0c09231 100644 --- a/svg-flatten/src/svg_doc.cpp +++ b/svg-flatten/src/svg_doc.cpp @@ -315,6 +315,14 @@ void gerbolyze::SVGDocument::export_svg_path(RenderContext &ctx, const pugi::xml } else { PolyTreeToPaths(ptree_fill, fill_paths); + cerr << "clip paths" << endl; + for (auto &p : fill_paths) { + cerr << " "; + for (auto &pt : p) { + cerr << "<" << pt.X << "," << pt.Y << "> "; + } + cerr << endl; + } RenderContext local_ctx(ctx, xform2d(), fill_paths, true); pattern->tile(local_ctx); } diff --git a/svg-flatten/src/svg_pattern.cpp b/svg-flatten/src/svg_pattern.cpp index b68bf3a..4e5b289 100644 --- a/svg-flatten/src/svg_pattern.cpp +++ b/svg-flatten/src/svg_pattern.cpp @@ -69,6 +69,7 @@ void gerbolyze::Pattern::tile (gerbolyze::RenderContext &ctx) { double by = clip_bounds.top / clipper_scale; double bw = (clip_bounds.right - clip_bounds.left) / clipper_scale; double bh = (clip_bounds.bottom - clip_bounds.top) / clipper_scale; + cerr << "clip bounds " << bx << ", " << by << "w=" << bw <<" h=" << bh << endl; d2p clip_p0 = patternTransform_inv.doc2phys(d2p{bx, by}); d2p clip_p1 = patternTransform_inv.doc2phys(d2p{bx+bw, by+bh}); @@ -90,12 +91,14 @@ void gerbolyze::Pattern::tile (gerbolyze::RenderContext &ctx) { /* Iterate over all pattern tiles in pattern coordinates */ for (double inst_off_x = fmod(inst_x, inst_w) - 2*inst_w; - inst_off_x < bw + 2*inst_w; + inst_off_x < bx + bw + 2*inst_w; inst_off_x += inst_w) { + cerr << "inst_off_x " << inst_off_x << endl; for (double inst_off_y = fmod(inst_y, inst_h) - 2*inst_h; - inst_off_y < bh + 2*inst_h; + inst_off_y < by + bh + 2*inst_h; inst_off_y += inst_h) { + cerr << " inst_off_y " << inst_off_y << endl; xform2d elem_xf; /* Change into this individual tile's coordinate system */ |