Mirror checkboxes added to the UI.
Everything seems to work fine.
This commit is contained in:
parent
bb73b59aa6
commit
38d54d779a
6 changed files with 48 additions and 10 deletions
|
@ -2259,15 +2259,17 @@ void PrintConfigDef::init_sla_params()
|
||||||
def->set_default_value(new ConfigOptionInt(1440));
|
def->set_default_value(new ConfigOptionInt(1440));
|
||||||
|
|
||||||
def = this->add("display_mirror_x", coBool);
|
def = this->add("display_mirror_x", coBool);
|
||||||
def->full_label = L("Display mirroring in X axis");
|
def->full_label = L("Display horizontal mirroring");
|
||||||
def->label = L("Mirror X");
|
def->label = L("Mirror horizontally");
|
||||||
def->tooltip = L("Enable mirroring of output images in the X axis");
|
def->tooltip = L("Enable horizontal mirroring of output images");
|
||||||
|
def->mode = comExpert;
|
||||||
def->set_default_value(new ConfigOptionBool(true));
|
def->set_default_value(new ConfigOptionBool(true));
|
||||||
|
|
||||||
def = this->add("display_mirror_y", coBool);
|
def = this->add("display_mirror_y", coBool);
|
||||||
def->full_label = L("Display mirroring in Y axis");
|
def->full_label = L("Display vertical mirroring");
|
||||||
def->label = L("Mirror Y");
|
def->label = L("Mirror vertically");
|
||||||
def->tooltip = L("Enable mirroring of output images in the Y axis");
|
def->tooltip = L("Enable vertical mirroring of output images");
|
||||||
|
def->mode = comExpert;
|
||||||
def->set_default_value(new ConfigOptionBool(false));
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("display_orientation", coEnum);
|
def = this->add("display_orientation", coEnum);
|
||||||
|
|
|
@ -58,6 +58,7 @@ private:
|
||||||
|
|
||||||
std::function<double(double)> m_gammafn;
|
std::function<double(double)> m_gammafn;
|
||||||
std::array<bool, 2> m_mirror;
|
std::array<bool, 2> m_mirror;
|
||||||
|
Format m_fmt = Format::PNG;
|
||||||
|
|
||||||
inline void flipy(agg::path_storage& path) const {
|
inline void flipy(agg::path_storage& path) const {
|
||||||
path.flip_y(0, m_resolution.height_px);
|
path.flip_y(0, m_resolution.height_px);
|
||||||
|
@ -101,6 +102,7 @@ public:
|
||||||
case Format::PNG: m_mirror = {false, true}; break;
|
case Format::PNG: m_mirror = {false, true}; break;
|
||||||
case Format::RAW: m_mirror = {false, false}; break;
|
case Format::RAW: m_mirror = {false, false}; break;
|
||||||
}
|
}
|
||||||
|
m_fmt = fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class P> void draw(const P &poly) {
|
template<class P> void draw(const P &poly) {
|
||||||
|
@ -131,6 +133,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline TBuffer& buffer() { return m_buf; }
|
inline TBuffer& buffer() { return m_buf; }
|
||||||
|
|
||||||
|
inline Format format() const { return m_fmt; }
|
||||||
|
|
||||||
inline const Raster::Resolution resolution() { return m_resolution; }
|
inline const Raster::Resolution resolution() { return m_resolution; }
|
||||||
|
|
||||||
|
@ -258,6 +262,11 @@ void Raster::save(std::ostream& stream, Format fmt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Raster::save(std::ostream &stream)
|
||||||
|
{
|
||||||
|
save(stream, m_impl->format());
|
||||||
|
}
|
||||||
|
|
||||||
RawBytes Raster::save(Format fmt)
|
RawBytes Raster::save(Format fmt)
|
||||||
{
|
{
|
||||||
assert(m_impl);
|
assert(m_impl);
|
||||||
|
@ -300,6 +309,11 @@ RawBytes Raster::save(Format fmt)
|
||||||
return {std::move(data)};
|
return {std::move(data)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RawBytes Raster::save()
|
||||||
|
{
|
||||||
|
return save(m_impl->format());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,17 @@ public:
|
||||||
~Raster();
|
~Raster();
|
||||||
|
|
||||||
/// Reallocated everything for the given resolution and pixel dimension.
|
/// Reallocated everything for the given resolution and pixel dimension.
|
||||||
void reset(const Resolution&, const PixelDim&, const std::array<bool, 2>& mirror, double gamma = 1.0);
|
/// The third parameter is either the X, Y mirroring or a supported format
|
||||||
void reset(const Resolution& r, const PixelDim& pd, Format o, double gamma = 1.0);
|
/// for which the correct mirroring will be configured.
|
||||||
|
void reset(const Resolution&,
|
||||||
|
const PixelDim&,
|
||||||
|
const std::array<bool, 2>& mirror,
|
||||||
|
double gamma = 1.0);
|
||||||
|
|
||||||
|
void reset(const Resolution& r,
|
||||||
|
const PixelDim& pd,
|
||||||
|
Format o,
|
||||||
|
double gamma = 1.0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release the allocated resources. Drawing in this state ends in
|
* Release the allocated resources. Drawing in this state ends in
|
||||||
|
@ -119,11 +128,17 @@ public:
|
||||||
void draw(const ExPolygon& poly);
|
void draw(const ExPolygon& poly);
|
||||||
void draw(const ClipperLib::Polygon& poly);
|
void draw(const ClipperLib::Polygon& poly);
|
||||||
|
|
||||||
|
// Saving the raster:
|
||||||
|
// It is possible to override the format given in the constructor but
|
||||||
|
// be aware that the mirroring will not be modified.
|
||||||
|
|
||||||
/// Save the raster on the specified stream.
|
/// Save the raster on the specified stream.
|
||||||
void save(std::ostream& stream, Format = Format::PNG);
|
void save(std::ostream& stream, Format);
|
||||||
|
void save(std::ostream& stream);
|
||||||
|
|
||||||
/// Save into a continuous byte stream which is returned.
|
/// Save into a continuous byte stream which is returned.
|
||||||
RawBytes save(Format fmt = Format::PNG);
|
RawBytes save(Format fmt);
|
||||||
|
RawBytes save();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // sla
|
} // sla
|
||||||
|
|
|
@ -1461,6 +1461,8 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
|
||||||
"display_height",
|
"display_height",
|
||||||
"display_pixels_x",
|
"display_pixels_x",
|
||||||
"display_pixels_y",
|
"display_pixels_y",
|
||||||
|
"display_mirror_x",
|
||||||
|
"display_mirror_y",
|
||||||
"display_orientation"
|
"display_orientation"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -509,6 +509,7 @@ const std::vector<std::string>& Preset::sla_printer_options()
|
||||||
"printer_technology",
|
"printer_technology",
|
||||||
"bed_shape", "max_print_height",
|
"bed_shape", "max_print_height",
|
||||||
"display_width", "display_height", "display_pixels_x", "display_pixels_y",
|
"display_width", "display_height", "display_pixels_x", "display_pixels_y",
|
||||||
|
"display_mirror_x", "display_mirror_y",
|
||||||
"display_orientation",
|
"display_orientation",
|
||||||
"fast_tilt_time", "slow_tilt_time", "area_fill",
|
"fast_tilt_time", "slow_tilt_time", "area_fill",
|
||||||
"relative_correction",
|
"relative_correction",
|
||||||
|
|
|
@ -2056,6 +2056,10 @@ void TabPrinter::build_sla()
|
||||||
line.append_option(optgroup->get_option("display_pixels_y"));
|
line.append_option(optgroup->get_option("display_pixels_y"));
|
||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
optgroup->append_single_option_line("display_orientation");
|
optgroup->append_single_option_line("display_orientation");
|
||||||
|
|
||||||
|
// FIXME: This should be on one line in the UI
|
||||||
|
optgroup->append_single_option_line("display_mirror_x");
|
||||||
|
optgroup->append_single_option_line("display_mirror_y");
|
||||||
|
|
||||||
optgroup = page->new_optgroup(_(L("Tilt")));
|
optgroup = page->new_optgroup(_(L("Tilt")));
|
||||||
line = { _(L("Tilt time")), "" };
|
line = { _(L("Tilt time")), "" };
|
||||||
|
|
Loading…
Reference in a new issue