we can draw inplace text annotation fully transparent, and be sure to use the alpha color when painting them

svn path=/trunk/playground/graphics/okular/; revision=604208
remotes/origin/KDE/4.0
Pino Toscano 20 years ago
parent cb414fbf1d
commit eb63c03bd5
  1. 6
      ui/pagepainter.cpp

@ -492,7 +492,9 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const Okular::Page
// honor opacity settings on supported types
unsigned int opacity = (unsigned int)( 255.0 * a->style.opacity );
if ( opacity <= 0 )
// skip the annotation drawing if all the annotation is fully
// transparent, but not with text annotations
if ( opacity <= 0 && a->subType() != Okular::Annotation::AText )
continue;
// get annotation boundary and drawn rect
@ -517,7 +519,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const Okular::Page
// otherwise draw it right after the text
bool bigger = mixedPainter->device()->width() > page->width();
QImage image( bigRect.size(), QImage::Format_ARGB32 );
image.fill( qRgba( a->style.color.red(), a->style.color.green(), a->style.color.blue(), 255 ) );
image.fill( qRgba( a->style.color.red(), a->style.color.green(), a->style.color.blue(), opacity ) );
QPainter painter( &image );
painter.setPen( Qt::black );
painter.setFont( text->textFont );

Loading…
Cancel
Save