Make control lines part of processing parameters

This commit is contained in:
Lawrence Lee
2020-07-09 11:43:23 -07:00
parent 7f647d188c
commit eb548f1aff
6 changed files with 158 additions and 6 deletions

View File

@@ -1904,7 +1904,12 @@ bool PerspectiveParams::operator ==(const PerspectiveParams& other) const
&& projection_shift_vert == other.projection_shift_vert
&& projection_rotate == other.projection_rotate
&& projection_pitch == other.projection_pitch
&& projection_yaw == other.projection_yaw;
&& projection_yaw == other.projection_yaw
// Lines could still be equivalent if the vectors aren't, but this is
// rare and a small issue. Besides, a proper comparison requires lots
// more code which introduces clutter.
&& control_line_values == other.control_line_values
&& control_line_types == other.control_line_types;
}
bool PerspectiveParams::operator !=(const PerspectiveParams& other) const
@@ -5210,6 +5215,8 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->perspective.projection_shift_horiz, "Perspective", "ProjectionShiftHorizontal", perspective.projection_shift_horiz, keyFile);
saveToKeyfile(!pedited || pedited->perspective.projection_shift_vert, "Perspective", "ProjectionShiftVertical", perspective.projection_shift_vert, keyFile);
saveToKeyfile(!pedited || pedited->perspective.projection_yaw, "Perspective", "ProjectionYaw", perspective.projection_yaw, keyFile);
saveToKeyfile(!pedited || pedited->perspective.control_lines, "Perspective", "ControlLineValues", perspective.control_line_values, keyFile);
saveToKeyfile(!pedited || pedited->perspective.control_lines, "Perspective", "ControlLineTypes", perspective.control_line_types, keyFile);
// Gradient
saveToKeyfile(!pedited || pedited->gradient.enabled, "Gradient", "Enabled", gradient.enabled, keyFile);
@@ -6839,6 +6846,13 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Perspective", "ProjectionShiftHorizontal", pedited, perspective.projection_shift_horiz, pedited->perspective.projection_shift_horiz);
assignFromKeyfile(keyFile, "Perspective", "ProjectionShiftVertical", pedited, perspective.projection_shift_vert, pedited->perspective.projection_shift_vert);
assignFromKeyfile(keyFile, "Perspective", "ProjectionYaw", pedited, perspective.projection_yaw, pedited->perspective.projection_yaw);
if (keyFile.has_key("Perspective", "ControlLineValues") && keyFile.has_key("Perspective", "ControlLineTypes")) {
perspective.control_line_values = keyFile.get_integer_list("Perspective", "ControlLineValues");
perspective.control_line_types = keyFile.get_integer_list("Perspective", "ControlLineTypes");
if (pedited) {
pedited->perspective.control_lines = true;
}
}
}
if (keyFile.has_group("Gradient")) {

View File

@@ -945,6 +945,10 @@ struct PerspectiveParams {
double projection_shift_horiz;
double projection_shift_vert;
double projection_yaw;
/** A line is stored as 4 integers in this order: x1, y1, x2, y2 */
std::vector<int> control_line_values;
/** 0 is vertical, 1 is horizontal, undefined otherwise. */
std::vector<int> control_line_types;
PerspectiveParams();