From 9230d678af465d2a7eaacaf379543ddd41cd3ef0 Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 4 Jun 2021 00:44:38 +0200 Subject: Add support for stroke-dashoffset --- svg-flatten/src/svg_doc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'svg-flatten/src') 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 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; -- cgit