aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/src/svg_path.cpp
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2021-02-17 18:58:11 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2021-02-17 18:58:11 +0100
commitda9d7280d5d099c65f3e8d134a60b4778a5bcfb2 (patch)
tree935676348176d3a06032ff4ac4440081a59a17bd /svg-flatten/src/svg_path.cpp
parentf9c5c00f513e6c6be70b033782976fd109eb4ac9 (diff)
downloadgerbolyze-da9d7280d5d099c65f3e8d134a60b4778a5bcfb2.tar.gz
gerbolyze-da9d7280d5d099c65f3e8d134a60b4778a5bcfb2.tar.bz2
gerbolyze-da9d7280d5d099c65f3e8d134a60b4778a5bcfb2.zip
svg-flatten: add curve flattening tolerance command line param
Diffstat (limited to 'svg-flatten/src/svg_path.cpp')
-rw-r--r--svg-flatten/src/svg_path.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/svg-flatten/src/svg_path.cpp b/svg-flatten/src/svg_path.cpp
index 68003ad..ce2775d 100644
--- a/svg-flatten/src/svg_path.cpp
+++ b/svg-flatten/src/svg_path.cpp
@@ -110,14 +110,14 @@ static pair<bool, bool> path_to_clipper_via_cairo(cairo_t *cr, ClipperLib::Clipp
return {has_closed, num_subpaths > 1};
}
-void gerbolyze::load_svg_path(cairo_t *cr, const pugi::xml_node &node, ClipperLib::PolyTree &ptree_stroke, ClipperLib::PolyTree &ptree_fill) {
+void gerbolyze::load_svg_path(cairo_t *cr, const pugi::xml_node &node, ClipperLib::PolyTree &ptree_stroke, ClipperLib::PolyTree &ptree_fill, double curve_tolerance) {
auto *path_data = node.attribute("d").value();
auto fill_rule = clipper_fill_rule(node);
/* For open paths, clipper does not correctly remove self-intersections. Thus, we pass everything into
* clipper twice: Once with all paths set to "closed" to compute fill areas, and once with correct
* open/closed properties for stroke offsetting. */
- cairo_set_tolerance (cr, 0.1); /* FIXME make configurable, scale properly for units */
+ cairo_set_tolerance (cr, curve_tolerance); /* FIXME make configurable, scale properly for units */
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING);
ClipperLib::Clipper c_stroke;