From 8ab0c9fa017b5ead2e3f5cfc892b242cd0bbc908 Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 21 Jun 2023 15:39:46 +0200 Subject: Make warning messages in color handling code easier to understand --- svg-flatten/src/main.cpp | 2 +- svg-flatten/src/out_sexp.cpp | 2 +- svg-flatten/src/svg_color.cpp | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'svg-flatten') diff --git a/svg-flatten/src/main.cpp b/svg-flatten/src/main.cpp index 179e0ab..68e21ea 100644 --- a/svg-flatten/src/main.cpp +++ b/svg-flatten/src/main.cpp @@ -73,7 +73,7 @@ int main(int argc, char **argv) { "Flip polarity of all output gerber primitives for --format gerber.", 0}, {"flip_svg_color_interpretation", {"-i", "--svg-white-is-gerber-dark"}, - "Flip polarity of SVG color interpretation. This affects only SVG primitives like paths and NOT embedded bitmaps. With -i: white -> silk there/\"dark\" gerber primitive.", + "Flip polarity of SVG color interpretation. This affects only SVG primitives like paths and NOT embedded bitmaps. With -i: white -> \"dark\" gerber primitive, i.e. silk or copper present, or mask absent.", 0}, {"pattern_complete_tiles_only", {"--pattern-complete-tiles-only"}, "Break SVG spec by only rendering complete pattern tiles, i.e. pattern tiles that entirely fit the target area, instead of performing clipping.", diff --git a/svg-flatten/src/out_sexp.cpp b/svg-flatten/src/out_sexp.cpp index 6c9f5ae..347bb7f 100644 --- a/svg-flatten/src/out_sexp.cpp +++ b/svg-flatten/src/out_sexp.cpp @@ -92,7 +92,7 @@ void KicadSexpOutput::header_impl(d2p, d2p) { KicadSexpOutput &KicadSexpOutput::operator<<(GerberPolarityToken pol) { if (pol == GRB_POL_CLEAR) { - cerr << "Warning: clear polarity not supported since KiCAD manages to have an even worse graphics model than gerber, except it can't excuse itself by its age..... -.-" << endl; + cerr << "Warning: Some shapes in this file were interpreted by svg-flatten as gerber \"clear\" polarity (background color). KiCad does not support clear polarity. Thus, these shapes will be omitted in the S-Expression output." << endl; } return *this; diff --git a/svg-flatten/src/svg_color.cpp b/svg-flatten/src/svg_color.cpp index 87aae3a..f2ae8eb 100644 --- a/svg-flatten/src/svg_color.cpp +++ b/svg-flatten/src/svg_color.cpp @@ -64,6 +64,10 @@ enum gerber_color gerbolyze::svg_color_to_gerber(string color, string opacity, e if (alpha < 0.5f) { //cerr << " -> none" << endl; + if (alpha > 0.01) { + cerr << "Info: Found an object with opacity set to " << alpha << ". This object will be omitted from the output." << endl; + } + return GRB_NONE; } @@ -74,6 +78,10 @@ enum gerber_color gerbolyze::svg_color_to_gerber(string color, string opacity, e //cerr << " -> dark" << endl; return GRB_DARK; } + + if (hsv.v >= 0.4 && hsv.v <= 0.6) { + cerr << "Warning: color \"" << color << "\" is ambiguous. Gerbolyze decides whether to map colors to clear or dark polarity by checking if their HSV value (i.e. brightness) is above 50 %. This color has a value of " << hsv.v << ", close to 50 %." << endl; + } } //cerr << " -> dark" << endl; -- cgit