Make warning messages in color handling code easier to understand

main
jaseg 2023-06-21 15:39:46 +02:00
rodzic 2fbde62df9
commit 8ab0c9fa01
3 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -73,7 +73,7 @@ int main(int argc, char **argv) {
"Flip polarity of all output gerber primitives for --format gerber.", "Flip polarity of all output gerber primitives for --format gerber.",
0}, 0},
{"flip_svg_color_interpretation", {"-i", "--svg-white-is-gerber-dark"}, {"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}, 0},
{"pattern_complete_tiles_only", {"--pattern-complete-tiles-only"}, {"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.", "Break SVG spec by only rendering complete pattern tiles, i.e. pattern tiles that entirely fit the target area, instead of performing clipping.",

Wyświetl plik

@ -92,7 +92,7 @@ void KicadSexpOutput::header_impl(d2p, d2p) {
KicadSexpOutput &KicadSexpOutput::operator<<(GerberPolarityToken pol) { KicadSexpOutput &KicadSexpOutput::operator<<(GerberPolarityToken pol) {
if (pol == GRB_POL_CLEAR) { 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; return *this;

Wyświetl plik

@ -64,6 +64,10 @@ enum gerber_color gerbolyze::svg_color_to_gerber(string color, string opacity, e
if (alpha < 0.5f) { if (alpha < 0.5f) {
//cerr << " -> none" << endl; //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; return GRB_NONE;
} }
@ -74,6 +78,10 @@ enum gerber_color gerbolyze::svg_color_to_gerber(string color, string opacity, e
//cerr << " -> dark" << endl; //cerr << " -> dark" << endl;
return GRB_DARK; 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; //cerr << " -> dark" << endl;