diff options
Diffstat (limited to 'qt-ui/printlayout.cpp')
-rw-r--r-- | qt-ui/printlayout.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
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 "<td>" + data + "</td>"; } + +// 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); +} |