fix PDF highlighting
Stefan Bund [Sat, 4 May 2013 22:41:48 +0000 (00:41 +0200)]
PDFWidget.cc

index b7ac623..02976cd 100644 (file)
@@ -145,16 +145,15 @@ prefix_ void pykit::PDFWidget::showPage()
                       dpi_, dpi_, 0, 0, width(), height()));
     QMatrix matrix (dpi_ / 72.0, 0, 0, dpi_ / 72.0, 0, 0);
 
+    QPainter painter;
+    painter.begin(&image);
+    painter.setCompositionMode(QPainter::CompositionMode_Darken);
     BOOST_FOREACH(QRectF const & highlightArea, highlightAreas_) {
         QRect highlightRect = matrix.mapRect(highlightArea).toRect();
-        highlightRect.adjust(-2, -2, 2, 2);
-        QImage highlight = image.copy(highlightRect);
-        QPainter painter;
-        painter.begin(&image);
-        painter.fillRect(image.rect(), QColor(0, 0, 0, 32));
-        painter.drawImage(highlightRect, highlight);
-        painter.end();
+        highlightRect.adjust(-2, -2, 2, 1);
+        painter.fillRect(highlightRect, QColor(244, 229, 0));
     }
+    painter.end();
 
     setPixmap(QPixmap::fromImage(image));
 }