Add ExportBackgroundColor config to GUI and CLI
parent
d3da2c8b22
commit
028b613f10
|
@ -94,6 +94,10 @@ void TextWindow::ScreenChangeFixExportColors(int link, uint32_t v) {
|
||||||
SS.fixExportColors = !SS.fixExportColors;
|
SS.fixExportColors = !SS.fixExportColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextWindow::ScreenChangeExportBackgroundColor(int link, uint32_t v) {
|
||||||
|
SS.exportBackgroundColor = !SS.exportBackgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
void TextWindow::ScreenChangeBackFaces(int link, uint32_t v) {
|
void TextWindow::ScreenChangeBackFaces(int link, uint32_t v) {
|
||||||
SS.drawBackFaces = !SS.drawBackFaces;
|
SS.drawBackFaces = !SS.drawBackFaces;
|
||||||
SS.GW.Invalidate(/*clearPersistent=*/true);
|
SS.GW.Invalidate(/*clearPersistent=*/true);
|
||||||
|
@ -299,6 +303,9 @@ void TextWindow::ShowConfiguration() {
|
||||||
Printf(false, " %Fd%f%Ll%s fix white exported lines%E",
|
Printf(false, " %Fd%f%Ll%s fix white exported lines%E",
|
||||||
&ScreenChangeFixExportColors,
|
&ScreenChangeFixExportColors,
|
||||||
SS.fixExportColors ? CHECK_TRUE : CHECK_FALSE);
|
SS.fixExportColors ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
Printf(false, " %Fd%f%Ll%s export background color%E",
|
||||||
|
&ScreenChangeExportBackgroundColor,
|
||||||
|
SS.exportBackgroundColor ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
|
||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
Printf(false, "%Ft export canvas size: "
|
Printf(false, "%Ft export canvas size: "
|
||||||
|
|
|
@ -25,6 +25,8 @@ Common options:
|
||||||
piecewise linear, and exact surfaces into triangle meshes.
|
piecewise linear, and exact surfaces into triangle meshes.
|
||||||
For export commands, the unit is mm, and the default is 1.0 mm.
|
For export commands, the unit is mm, and the default is 1.0 mm.
|
||||||
For non-export commands, the unit is %%, and the default is 1.0 %%.
|
For non-export commands, the unit is %%, and the default is 1.0 %%.
|
||||||
|
-b, --bg-color <on|off>
|
||||||
|
Whether to export the background colour in vector formats. Defaults to off.
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
thumbnail --output <pattern> --size <size> --view <direction>
|
thumbnail --output <pattern> --size <size> --view <direction>
|
||||||
|
@ -33,6 +35,7 @@ Commands:
|
||||||
<size> is <width>x<height>, in pixels. Graphics acceleration is
|
<size> is <width>x<height>, in pixels. Graphics acceleration is
|
||||||
not used, and the output may look slightly different from the GUI.
|
not used, and the output may look slightly different from the GUI.
|
||||||
export-view --output <pattern> --view <direction> [--chord-tol <tolerance>]
|
export-view --output <pattern> --view <direction> [--chord-tol <tolerance>]
|
||||||
|
[--bg-color <on|off>]
|
||||||
Exports a view of the sketch, in a 2d vector format.
|
Exports a view of the sketch, in a 2d vector format.
|
||||||
export-wireframe --output <pattern> [--chord-tol <tolerance>]
|
export-wireframe --output <pattern> [--chord-tol <tolerance>]
|
||||||
Exports a wireframe of the sketch, in a 3d vector format.
|
Exports a wireframe of the sketch, in a 3d vector format.
|
||||||
|
@ -155,6 +158,21 @@ static bool RunCommand(const std::vector<std::string> args) {
|
||||||
} else return false;
|
} else return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool bg_color = false;
|
||||||
|
auto ParseBgColor = [&](size_t &argn) {
|
||||||
|
if(argn + 1 < args.size() && (args[argn] == "--bg-color" ||
|
||||||
|
args[argn] == "-b")) {
|
||||||
|
argn++;
|
||||||
|
if(args[argn] == "on") {
|
||||||
|
bg_color = true;
|
||||||
|
return true;
|
||||||
|
} else if(args[argn] == "off") {
|
||||||
|
bg_color = false;
|
||||||
|
return true;
|
||||||
|
} else return false;
|
||||||
|
} else return false;
|
||||||
|
};
|
||||||
|
|
||||||
unsigned width = 0, height = 0;
|
unsigned width = 0, height = 0;
|
||||||
if(args[1] == "thumbnail") {
|
if(args[1] == "thumbnail") {
|
||||||
auto ParseSize = [&](size_t &argn) {
|
auto ParseSize = [&](size_t &argn) {
|
||||||
|
@ -221,7 +239,8 @@ static bool RunCommand(const std::vector<std::string> args) {
|
||||||
if(!(ParseInputFile(argn) ||
|
if(!(ParseInputFile(argn) ||
|
||||||
ParseOutputPattern(argn) ||
|
ParseOutputPattern(argn) ||
|
||||||
ParseViewDirection(argn) ||
|
ParseViewDirection(argn) ||
|
||||||
ParseChordTolerance(argn))) {
|
ParseChordTolerance(argn) ||
|
||||||
|
ParseBgColor(argn))) {
|
||||||
fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str());
|
fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -233,9 +252,10 @@ static bool RunCommand(const std::vector<std::string> args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
runner = [&](const Platform::Path &output) {
|
runner = [&](const Platform::Path &output) {
|
||||||
SS.GW.projRight = projRight;
|
SS.GW.projRight = projRight;
|
||||||
SS.GW.projUp = projUp;
|
SS.GW.projUp = projUp;
|
||||||
SS.exportChordTol = chordTol;
|
SS.exportChordTol = chordTol;
|
||||||
|
SS.exportBackgroundColor = bg_color;
|
||||||
|
|
||||||
SS.ExportViewOrWireframeTo(output, /*exportWireframe=*/false);
|
SS.ExportViewOrWireframeTo(output, /*exportWireframe=*/false);
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,6 +68,8 @@ void SolveSpaceUI::Init() {
|
||||||
exportOffset = settings->ThawFloat("ExportOffset", 0.0);
|
exportOffset = settings->ThawFloat("ExportOffset", 0.0);
|
||||||
// Rewrite exported colors close to white into black (assuming white bg)
|
// Rewrite exported colors close to white into black (assuming white bg)
|
||||||
fixExportColors = settings->ThawBool("FixExportColors", true);
|
fixExportColors = settings->ThawBool("FixExportColors", true);
|
||||||
|
// Export background color
|
||||||
|
exportBackgroundColor = settings->ThawBool("ExportBackgroundColor", false);
|
||||||
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
|
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
|
||||||
drawBackFaces = settings->ThawBool("DrawBackFaces", true);
|
drawBackFaces = settings->ThawBool("DrawBackFaces", true);
|
||||||
// Use turntable mouse navigation
|
// Use turntable mouse navigation
|
||||||
|
@ -246,6 +248,8 @@ void SolveSpaceUI::Exit() {
|
||||||
settings->FreezeFloat("ExportOffset", exportOffset);
|
settings->FreezeFloat("ExportOffset", exportOffset);
|
||||||
// Rewrite exported colors close to white into black (assuming white bg)
|
// Rewrite exported colors close to white into black (assuming white bg)
|
||||||
settings->FreezeBool("FixExportColors", fixExportColors);
|
settings->FreezeBool("FixExportColors", fixExportColors);
|
||||||
|
// Export background color
|
||||||
|
settings->FreezeBool("ExportBackgroundColor", exportBackgroundColor);
|
||||||
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
|
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
|
||||||
settings->FreezeBool("DrawBackFaces", drawBackFaces);
|
settings->FreezeBool("DrawBackFaces", drawBackFaces);
|
||||||
// Draw closed polygons areas
|
// Draw closed polygons areas
|
||||||
|
|
|
@ -559,6 +559,7 @@ public:
|
||||||
double exportScale;
|
double exportScale;
|
||||||
double exportOffset;
|
double exportOffset;
|
||||||
bool fixExportColors;
|
bool fixExportColors;
|
||||||
|
bool exportBackgroundColor;
|
||||||
bool drawBackFaces;
|
bool drawBackFaces;
|
||||||
bool showContourAreas;
|
bool showContourAreas;
|
||||||
bool checkClosedContour;
|
bool checkClosedContour;
|
||||||
|
|
1
src/ui.h
1
src/ui.h
|
@ -434,6 +434,7 @@ public:
|
||||||
static void ScreenGoToWebsite(int link, uint32_t v);
|
static void ScreenGoToWebsite(int link, uint32_t v);
|
||||||
|
|
||||||
static void ScreenChangeFixExportColors(int link, uint32_t v);
|
static void ScreenChangeFixExportColors(int link, uint32_t v);
|
||||||
|
static void ScreenChangeExportBackgroundColor(int link, uint32_t v);
|
||||||
static void ScreenChangeBackFaces(int link, uint32_t v);
|
static void ScreenChangeBackFaces(int link, uint32_t v);
|
||||||
static void ScreenChangeShowContourAreas(int link, uint32_t v);
|
static void ScreenChangeShowContourAreas(int link, uint32_t v);
|
||||||
static void ScreenChangeCheckClosedContour(int link, uint32_t v);
|
static void ScreenChangeCheckClosedContour(int link, uint32_t v);
|
||||||
|
|
Loading…
Reference in New Issue