mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
Fixed the bug of thumbnail mirroring
This commit is contained in:
@@ -38,7 +38,7 @@ std::unique_ptr<CompressedImageBuffer> compress_thumbnail_png(
|
|||||||
MZ_DEFAULT_LEVEL, 1);
|
MZ_DEFAULT_LEVEL, 1);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
// B3
|
//B3
|
||||||
std::string compress_qidi_thumbnail_png(const ThumbnailData &data)
|
std::string compress_qidi_thumbnail_png(const ThumbnailData &data)
|
||||||
{
|
{
|
||||||
auto out = std::make_unique<CompressedPNG>();
|
auto out = std::make_unique<CompressedPNG>();
|
||||||
@@ -59,7 +59,7 @@ std::string compress_qidi_thumbnail_png(const ThumbnailData &data)
|
|||||||
std::vector<uint8_t> rgba_pixels(data.pixels.size() * 4);
|
std::vector<uint8_t> rgba_pixels(data.pixels.size() * 4);
|
||||||
size_t row_size = width * 4;
|
size_t row_size = width * 4;
|
||||||
for (size_t y = 0; y <height; ++y)
|
for (size_t y = 0; y <height; ++y)
|
||||||
memcpy(rgba_pixels.data() + (height - y - 1) * row_size,
|
memcpy(rgba_pixels.data() + y * row_size,
|
||||||
data.pixels.data() + y * row_size, row_size);
|
data.pixels.data() + y * row_size, row_size);
|
||||||
const unsigned char *pixels;
|
const unsigned char *pixels;
|
||||||
pixels = (const unsigned char *) rgba_pixels.data();
|
pixels = (const unsigned char *) rgba_pixels.data();
|
||||||
@@ -68,12 +68,13 @@ std::string compress_qidi_thumbnail_png(const ThumbnailData &data)
|
|||||||
int time = width * height-1; // 200*200-1;
|
int time = width * height-1; // 200*200-1;
|
||||||
|
|
||||||
for (unsigned int r = 0; r < height; ++r) {
|
for (unsigned int r = 0; r < height; ++r) {
|
||||||
unsigned int rr = (height - 1 - r) * width;
|
unsigned int rr = r * width;
|
||||||
for (unsigned int c = 0; c < width; ++c) {
|
for (unsigned int c = 0; c < width; ++c) {
|
||||||
rrrr = int(pixels[4 * (rr + c) + 0]) >> 3;
|
unsigned int cc = width - c -1;
|
||||||
gggg = int(pixels[4 * (rr + c) + 1]) >> 2;
|
rrrr = int(pixels[4 * (rr + cc) + 0]) >> 3;
|
||||||
bbbb = int(pixels[4 * (rr + c) + 2]) >> 3;
|
gggg = int(pixels[4 * (rr + cc) + 1]) >> 2;
|
||||||
aaaa = int(pixels[4 * (rr + c) + 3]);
|
bbbb = int(pixels[4 * (rr + cc) + 2]) >> 3;
|
||||||
|
aaaa = int(pixels[4 * (rr + cc) + 3]);
|
||||||
if (aaaa == 0) {
|
if (aaaa == 0) {
|
||||||
rrrr = 239 >> 3;
|
rrrr = 239 >> 3;
|
||||||
gggg = 243 >> 2;
|
gggg = 243 >> 2;
|
||||||
|
|||||||
@@ -3471,27 +3471,29 @@ void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_remova
|
|||||||
this->restart_background_process(priv::UPDATE_BACKGROUND_PROCESS_FORCE_EXPORT);
|
this->restart_background_process(priv::UPDATE_BACKGROUND_PROCESS_FORCE_EXPORT);
|
||||||
|
|
||||||
//Y6 PrintHint
|
//Y6 PrintHint
|
||||||
std::string filament_type;
|
if(wxGetApp().get_mode() == comSimple) {
|
||||||
bool ShowPrintHint = false;
|
std::string filament_type;
|
||||||
const PrintStatistics& ps = this->fff_print.print_statistics();
|
bool ShowPrintHint = false;
|
||||||
const auto& extruders_filaments = wxGetApp().preset_bundle->extruders_filaments;
|
const PrintStatistics& ps = this->fff_print.print_statistics();
|
||||||
std::list<std::string> FilamentsHintList = {"PETG", "PLA", "TPU"};
|
const auto& extruders_filaments = wxGetApp().preset_bundle->extruders_filaments;
|
||||||
|
std::list<std::string> FilamentsHintList = {"PETG", "PLA", "TPU"};
|
||||||
|
|
||||||
for (const auto& [filament_id, filament_vol] : ps.filament_stats) {
|
for (const auto& [filament_id, filament_vol] : ps.filament_stats) {
|
||||||
assert(filament_id < extruders_filaments.size());
|
assert(filament_id < extruders_filaments.size());
|
||||||
if (const Preset* preset = extruders_filaments[filament_id].get_selected_preset()) {
|
if (const Preset* preset = extruders_filaments[filament_id].get_selected_preset()) {
|
||||||
filament_type = preset->config.opt_string("filament_type", filament_id);
|
filament_type = preset->config.opt_string("filament_type", filament_id);
|
||||||
if (std::find(FilamentsHintList.begin(), FilamentsHintList.end(), filament_type) != FilamentsHintList.end()) {
|
if (std::find(FilamentsHintList.begin(), FilamentsHintList.end(), filament_type) != FilamentsHintList.end()) {
|
||||||
ShowPrintHint = true;
|
ShowPrintHint = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ShowPrintHint) {
|
if (ShowPrintHint) {
|
||||||
std::string message;
|
std::string message;
|
||||||
message = _u8L("Opening the front door and top cover before printing can improve heat dissipation, obtain better print quality, and prevent extruder blockage.");
|
message = _u8L("Opening the front door and top cover before printing can improve heat dissipation, obtain better print quality, and prevent extruder blockage.");
|
||||||
notification_manager->push_notification(message);
|
notification_manager->push_notification(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user