diff options
author | jaseg <git@jaseg.de> | 2021-01-26 23:21:31 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-01-26 23:21:31 +0100 |
commit | 3cee5d4f018be6d4f494fb2ab1018fbf53b2f15f (patch) | |
tree | 993db446589acb970392bf4a40049088bd30630c /src/main.cpp | |
parent | bc0ef634cf5142ea51c55d63b241c1f5e1d0e4b2 (diff) | |
download | gerbolyze-3cee5d4f018be6d4f494fb2ab1018fbf53b2f15f.tar.gz gerbolyze-3cee5d4f018be6d4f494fb2ab1018fbf53b2f15f.tar.bz2 gerbolyze-3cee5d4f018be6d4f494fb2ab1018fbf53b2f15f.zip |
The cavalier flattener works!!1!
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 8656662..773b1a4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char **argv) { {"no_header", {"--no-header"}, "Do not export output format header/footer, only export the primitives themselves", 0}, - {"flatten", {"-f", "--flatten"}, + {"flatten", {"--flatten"}, "Flatten output so it only consists of non-overlapping white polygons. This perform composition at the vector level. Potentially slow.", 0}, }}; @@ -122,7 +122,8 @@ int main(int argc, char **argv) { string fmt = args["ofmt"] ? args["ofmt"] : "gerber"; transform(fmt.begin(), fmt.end(), fmt.begin(), [](unsigned char c){ return std::tolower(c); }); - PolygonSink *sink; + PolygonSink *sink = nullptr; + PolygonSink *flattener = nullptr; if (fmt == "svg") { string dark_color = args["svg_dark_color"] ? args["svg_dark_color"] : "#000000"; string clear_color = args["svg_clear_color"] ? args["svg_clear_color"] : "#ffffff"; @@ -138,10 +139,11 @@ int main(int argc, char **argv) { return EXIT_FAILURE; } - if (args["version"]) { + if (args["flatten"]) { + flattener = new Flattener(*sink); } - doc.render(*sink); + doc.render(flattener ? *flattener : *sink); return EXIT_SUCCESS; } |