diff --git a/ui/data/tools.xml b/ui/data/tools.xml index 1903060f2..fd5a8c3da 100644 --- a/ui/data/tools.xml +++ b/ui/data/tools.xml @@ -2,7 +2,7 @@ - - this .. - - - - 1 + + .. is .. + + + + 1 - - .. is .. - - - - 2 + + .. is .. + + + + 2 + + + this .. + + + + 3 - + .. tooltip .. + 4 - + .. test 5 - - - - - 6 - diff --git a/ui/pagepainter.cpp b/ui/pagepainter.cpp index 8ea1ccb1b..226990fa0 100644 --- a/ui/pagepainter.cpp +++ b/ui/pagepainter.cpp @@ -242,10 +242,11 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p if ( bufferedAnnotations ) { // precalc costants for normalizing the quads to the image - double xOffset = (float)limits.left() / (float)scaledWidth, - xScale = (float)scaledWidth / (float)limits.width(), - yOffset = (float)limits.top() / (float)scaledHeight, - yScale = (float)scaledHeight / (float)limits.height(); + double pageScale = (double)scaledWidth / page->width(); + double xOffset = (double)limits.left() / (double)scaledWidth, + xScale = (double)scaledWidth / (double)limits.width(), + yOffset = (double)limits.top() / (double)scaledHeight, + yScale = (double)scaledHeight / (double)limits.height(); // paint all buffered annotations in the page QValueList< Annotation * >::const_iterator aIt = bufferedAnnotations->begin(), aEnd = bufferedAnnotations->end(); @@ -274,7 +275,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p point.y = (inkPoint.y - yOffset) * yScale; path.append( point ); // draw the normalized path into image - drawShapeOnImage( backImage, path, false, QPen( a->style.color ), QBrush() ); + drawShapeOnImage( backImage, path, false, QPen( a->style.color ), QBrush(), pageScale ); */ } // draw GeomAnnotation MISSING: all @@ -308,7 +309,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p { // highlight the whole rect case HighlightAnnotation::Highlight: - drawShapeOnImage( backImage, path, true, QPen(), a->style.color, Multiply ); + drawShapeOnImage( backImage, path, true, QPen(), a->style.color, pageScale, Multiply ); break; // highlight the bottom part of the rect case HighlightAnnotation::Squiggly: @@ -316,7 +317,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p path[ 0 ].y = ( path[ 0 ].y + path[ 3 ].y ) / 2.0; path[ 1 ].x = ( path[ 1 ].x + path[ 2 ].x ) / 2.0; path[ 1 ].y = ( path[ 1 ].y + path[ 2 ].y ) / 2.0; - drawShapeOnImage( backImage, path, true, QPen(), a->style.color, Multiply ); + drawShapeOnImage( backImage, path, true, QPen(), a->style.color, pageScale, Multiply ); break; // make a line at 3/4 of the height case HighlightAnnotation::Underline: @@ -326,7 +327,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p path[ 1 ].y = ( path[ 1 ].y + 3*path[ 2 ].y ) / 4.0; path.pop_back(); path.pop_back(); - drawShapeOnImage( backImage, path, false, QPen( a->style.color, 2 ), QBrush() ); + drawShapeOnImage( backImage, path, false, QPen( a->style.color, 2 ), QBrush(), pageScale ); break; // make a line at 1/2 of the height case HighlightAnnotation::StrikeOut: @@ -336,7 +337,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p path[ 1 ].y = ( path[ 1 ].y + path[ 2 ].y ) / 2.0; path.pop_back(); path.pop_back(); - drawShapeOnImage( backImage, path, false, QPen( a->style.color, 2 ), QBrush() ); + drawShapeOnImage( backImage, path, false, QPen( a->style.color, 2 ), QBrush(), pageScale ); break; } } @@ -365,7 +366,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p path.append( point ); } // draw the normalized path into image - drawShapeOnImage( backImage, path, false, QPen( a->style.color, 2 ), QBrush() ); + drawShapeOnImage( backImage, path, false, QPen( a->style.color, a->style.width ), QBrush(), pageScale ); } } } // end current annotation drawing @@ -644,6 +645,7 @@ void PagePainter::drawShapeOnImage( bool closeShape, const QPen & pen, const QBrush & brush, + double penWidthMultiplier, RasterOperation op //float antiAliasRadius ) @@ -701,12 +703,13 @@ void PagePainter::drawShapeOnImage( } // stroke outline - if ( pen.width() != 0 ) + double penWidth = (double)pen.width() * penWidthMultiplier; + if ( penWidth > 0.1 ) { const QColor & penColor = pen.color(); render.color( agg::rgba8( penColor.red(), penColor.green(), penColor.blue() ) ); agg::conv_stroke< agg::path_storage > strokedPath( path ); - strokedPath.width( pen.width() ); + strokedPath.width( penWidth ); rasterizer.add_path( strokedPath ); agg::render_scanlines( rasterizer, scanline, render ); } diff --git a/ui/pagepainter.h b/ui/pagepainter.h index 18c9ea797..543b0beb4 100644 --- a/ui/pagepainter.h +++ b/ui/pagepainter.h @@ -60,6 +60,7 @@ class PagePainter bool closeShape = true, const QPen & pen = QPen(), const QBrush & brush = QBrush(), + double penWidthMultiplier = 1.0, RasterOperation op = Normal //float antiAliasRadius = 1.0 );