aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/src/main.cpp
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-01-31 22:11:34 +0100
committerjaseg <git@jaseg.de>2021-01-31 22:11:34 +0100
commita68e395cb622b9cb91e408b0846cc10126f8ddad (patch)
tree14c02a7eed139d1f750923f77350fd941fcfa025 /svg-flatten/src/main.cpp
parent49a7c6df416b18516fca776614cb0aa0f483798f (diff)
downloadgerbolyze-a68e395cb622b9cb91e408b0846cc10126f8ddad.tar.gz
gerbolyze-a68e395cb622b9cb91e408b0846cc10126f8ddad.tar.bz2
gerbolyze-a68e395cb622b9cb91e408b0846cc10126f8ddad.zip
Advanced svg/gerber composition working
Diffstat (limited to 'svg-flatten/src/main.cpp')
-rw-r--r--svg-flatten/src/main.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/svg-flatten/src/main.cpp b/svg-flatten/src/main.cpp
index 135a4c1..d05672a 100644
--- a/svg-flatten/src/main.cpp
+++ b/svg-flatten/src/main.cpp
@@ -82,6 +82,12 @@ int main(int argc, char **argv) {
{"skip_usvg", {"--no-usvg"},
"Do not preprocess input using usvg (do not use unless you know *exactly* what you're doing)",
0},
+ {"usvg_dpi", {"--usvg-dpi"},
+ "Passed through to usvg's --dpi, in case the input file has different ideas of DPI than usvg has.",
+ 1},
+ {"scale", {"--scale"},
+ "Scale input svg lengths by this factor.",
+ 1},
{"exclude_groups", {"-e", "--exclude-groups"},
"Comma-separated list of group IDs to exclude from export. Takes precedence over --only-groups.",
1},
@@ -176,7 +182,9 @@ int main(int argc, char **argv) {
sink = new SimpleSVGOutput(*out_f, only_polys, precision, dark_color, clear_color);
} else if (fmt == "gbr" || fmt == "grb" || fmt == "gerber") {
- sink = new SimpleGerberOutput(*out_f, only_polys, 4, precision);
+ double scale = args["scale"].as<double>(1.0);
+ cerr << "loading @scale=" << scale << endl;
+ sink = new SimpleGerberOutput(*out_f, only_polys, 4, precision, scale);
} else if (fmt == "s-exp" || fmt == "sexp" || fmt == "kicad") {
if (!args["sexp_mod_name"]) {
@@ -334,7 +342,13 @@ int main(int argc, char **argv) {
} else {
cerr << "calling usvg on " << barf << " and " << frob << endl;
- const char *command_line[] = {"usvg", "--keep-named-groups", barf.c_str(), frob.c_str(), NULL};
+ int dpi = 96;
+ if (args["usvg_dpi"]) {
+ dpi = args["usvg_dpi"].as<int>();
+ }
+ string dpi_str = to_string(dpi);
+
+ const char *command_line[] = {"usvg", "--keep-named-groups", "--dpi", dpi_str.c_str(), barf.c_str(), frob.c_str(), NULL};
struct subprocess_s subprocess;
int rc = subprocess_create(command_line, subprocess_option_inherit_environment, &subprocess);
if (rc) {