From: Stefan Bund Date: Sat, 4 May 2013 22:41:48 +0000 (+0200) Subject: fix PDF highlighting X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=e327931915d918c8d7a44ba28d22ee28bae24208;p=pykit.git fix PDF highlighting --- diff --git a/PDFWidget.cc b/PDFWidget.cc index b7ac623..02976cd 100644 --- a/PDFWidget.cc +++ b/PDFWidget.cc @@ -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)); }