diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp
index 935a4cc91..0ef37d5a3 100644
--- a/qt-ui/printlayout.cpp
+++ b/qt-ui/printlayout.cpp
@@ -108,7 +108,9 @@ void PrintLayout::printSixDives() const
QTransform transform;
transform.rotate(270);
pm = QPixmap(pm.transformed(transform));
- painter.drawPixmap(0, 0, pm);
+ if (!printOptions->color_selected)
+ pm = convertPixmapToGrayscale(pm);
+ painter.drawPixmap(0, 0, pm);
}
painter.end();
profile->setPrintMode(false);
@@ -244,3 +246,17 @@ QString PrintLayout::insertTableDataCol(QString data) const
{
return "
" + data + " | ";
}
+
+// experimental
+QPixmap PrintLayout::convertPixmapToGrayscale(QPixmap pixmap) const
+{
+ QImage image = pixmap.toImage();
+ int gray, width = pixmap.width(), height = pixmap.height();
+ for (int i = 0; i < width; i++) {
+ for (int j = 0; j < height; j++) {
+ gray = qGray(image.pixel(i, j));
+ image.setPixel(i, j, qRgb(gray, gray, gray));
+ }
+ }
+ return pixmap.fromImage(image);
+}
diff --git a/qt-ui/printlayout.h b/qt-ui/printlayout.h
index cbb1e42ac..7a1922e4a 100644
--- a/qt-ui/printlayout.h
+++ b/qt-ui/printlayout.h
@@ -34,6 +34,7 @@ private:
QString insertTableHeadingCol(int) const;
QString insertTableDataRow(struct dive *) const;
QString insertTableDataCol(QString) const;
+ QPixmap convertPixmapToGrayscale(QPixmap) const;
};
#endif