aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-06-04 00:44:38 +0200
committerjaseg <git@jaseg.de>2021-06-04 00:44:38 +0200
commit9230d678af465d2a7eaacaf379543ddd41cd3ef0 (patch)
treeb8427e9b31a3c0c9aee7a8e7c843e03e7cfb1e81
parentf1bf25b51f51a3a399414a9b56e006c7d66b1022 (diff)
downloadgerbolyze-9230d678af465d2a7eaacaf379543ddd41cd3ef0.tar.gz
gerbolyze-9230d678af465d2a7eaacaf379543ddd41cd3ef0.tar.bz2
gerbolyze-9230d678af465d2a7eaacaf379543ddd41cd3ef0.zip
Add support for stroke-dashoffset
-rw-r--r--svg-flatten/src/svg_doc.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/svg-flatten/src/svg_doc.cpp b/svg-flatten/src/svg_doc.cpp
index 18b744b..1d85fd8 100644
--- a/svg-flatten/src/svg_doc.cpp
+++ b/svg-flatten/src/svg_doc.cpp
@@ -217,6 +217,7 @@ void gerbolyze::SVGDocument::export_svg_path(xform2d &mat, const RenderSettings
enum ClipperLib::JoinType join_type = clipper_join_type(node);
vector<double> dasharray;
parse_dasharray(node, dasharray);
+ double stroke_dashoffset = usvg_double_attr(node, "stroke-dashoffset", /* default */ 0.0);
/* TODO add stroke-miterlimit */
if (!fill_color && !stroke_color) { /* Ignore "transparent" paths */
@@ -320,7 +321,7 @@ void gerbolyze::SVGDocument::export_svg_path(xform2d &mat, const RenderSettings
Path poly_copy(poly);
poly_copy.push_back(poly[0]);
Paths out;
- dash_path(poly_copy, out, dasharray);
+ dash_path(poly_copy, out, dasharray, stroke_dashoffset);
if (rset.outline_mode && stroke_color != GRB_PATTERN_FILL) {
*polygon_sink << ApertureToken(stroke_width) << out;
@@ -332,7 +333,7 @@ void gerbolyze::SVGDocument::export_svg_path(xform2d &mat, const RenderSettings
for (const auto &poly : open_paths) {
Paths out;
- dash_path(poly, out, dasharray);
+ dash_path(poly, out, dasharray, stroke_dashoffset);
if (rset.outline_mode && stroke_color != GRB_PATTERN_FILL) {
*polygon_sink << ApertureToken(stroke_width) << out;