aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/src/out_gerber.cpp
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2021-03-19 20:32:13 +0100
committerjaseg <code@jaseg.net>2021-04-05 13:57:40 +0200
commit3288fb8345c07b4ca0deff82805d330f7d80bee7 (patch)
treeae8aed57df1457797ae4b31cce555191ee7d0fbc /svg-flatten/src/out_gerber.cpp
parent0be9f4b3bae743fe3ed9359daf54b54aa5f31f88 (diff)
downloadgerbolyze-3288fb8345c07b4ca0deff82805d330f7d80bee7.tar.gz
gerbolyze-3288fb8345c07b4ca0deff82805d330f7d80bee7.tar.bz2
gerbolyze-3288fb8345c07b4ca0deff82805d330f7d80bee7.zip
Add -f/--flip-gerber-polarity option
Diffstat (limited to 'svg-flatten/src/out_gerber.cpp')
-rw-r--r--svg-flatten/src/out_gerber.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/svg-flatten/src/out_gerber.cpp b/svg-flatten/src/out_gerber.cpp
index f16a06b..9513c0b 100644
--- a/svg-flatten/src/out_gerber.cpp
+++ b/svg-flatten/src/out_gerber.cpp
@@ -27,12 +27,13 @@
using namespace gerbolyze;
using namespace std;
-SimpleGerberOutput::SimpleGerberOutput(ostream &out, bool only_polys, int digits_int, int digits_frac, double scale, d2p offset)
+SimpleGerberOutput::SimpleGerberOutput(ostream &out, bool only_polys, int digits_int, int digits_frac, double scale, d2p offset, bool flip_polarity)
: StreamPolygonSink(out, only_polys),
m_digits_int(digits_int),
m_digits_frac(digits_frac),
m_offset(offset),
- m_scale(scale)
+ m_scale(scale),
+ m_flip_pol(flip_polarity)
{
assert(1 <= digits_int && digits_int <= 9);
assert(0 <= digits_frac && digits_frac <= 9);
@@ -58,12 +59,12 @@ void SimpleGerberOutput::header_impl(d2p origin, d2p size) {
}
SimpleGerberOutput& SimpleGerberOutput::operator<<(GerberPolarityToken pol) {
- if (pol == GRB_POL_DARK) {
+ assert(pol == GRB_POL_DARK || pol == GRB_POL_CLEAR);
+
+ if ((pol == GRB_POL_DARK) != m_flip_pol) {
m_out << "%LPD*%" << endl;
} else if (pol == GRB_POL_CLEAR) {
m_out << "%LPC*%" << endl;
- } else {
- assert(false);
}
return *this;