mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-30 06:12:01 +08:00
Ported scaled_points_to_pixel, made Polygon and Polylines versions.
This commit is contained in:
parent
456212918f
commit
aef1bf7f37
@ -157,6 +157,16 @@ void Plate2D::update_bed_size() {
|
||||
assert(this->scaling_factor != 0);
|
||||
|
||||
|
||||
std::vector<wxPoint> Plate2D::scaled_points_to_pixel(const Slic3r::Polygon& poly, bool unscale) {
|
||||
return this->scaled_points_to_pixel(Polyline(poly), unscale);
|
||||
}
|
||||
|
||||
std::vector<wxPoint> Plate2D::scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale) {
|
||||
std::vector<wxPoint> result;
|
||||
for (const auto& pt : poly.points) {
|
||||
const auto tmp {wxPoint(pt.x, pt.y)};
|
||||
result.push_back( (unscale ? unscaled_point_to_pixel(tmp) : tmp) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
} } // Namespace Slic3r::GUI
|
||||
|
@ -66,7 +66,8 @@ private:
|
||||
void set_colors();
|
||||
|
||||
/// Convert a scale point array to a pixel polygon suitable for DrawPolygon
|
||||
std::vector<wxPoint> scaled_points_to_pixel(std::vector<wxPoint> points, bool unscale);
|
||||
std::vector<wxPoint> scaled_points_to_pixel(const Slic3r::Polygon& poly, bool unscale);
|
||||
std::vector<wxPoint> scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale);
|
||||
|
||||
// For a specific point, unscaled it
|
||||
wxPoint unscaled_point_to_pixel(const wxPoint& in) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user