[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/ksnapshot
From:       Pau Garcia i Quiles <pgquiles () elpauer ! org>
Date:       2010-11-12 0:10:37
Message-ID: 20101112001037.BF5D3AC89E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1195780 by pgquiles:

Antialias screenshot in freehand capture mode. Thanks to kdepepo for the snippet.

CCMAIL: christoph@maxiom.de



 M  +10 -2     freeregiongrabber.cpp  


--- trunk/KDE/kdegraphics/ksnapshot/freeregiongrabber.cpp #1195779:1195780
@@ -293,8 +293,16 @@
 
         QPainter pt;
         pt.begin(&pixmap2);
-        pt.setCompositionMode(QPainter::CompositionMode_Source);
-        pt.setClipRegion(QRegion(translatedPol));
+//        [02:34] <kdepepo> pgquiles, http://www.kde.pastebin.ca/1986921 works, but \
you have to improve it. +//        First you need to make sure the painter actually \
supports the advanced compositing modes. +//        Fall back to old code, if not. \
Additionally, you probably might need to shift the polygon rendering +//        by a \
half pixel, or use a half pixel outline pen, so that straight lines aren't \
antialiased at half the pixel. +        \
pt.setRenderHints(QPainter::Antialiasing|QPainter::HighQualityAntialiasing|QPainter::SmoothPixmapTransform, \
true); +        pt.setBrush(Qt::black);
+        pt.setPen(QPen(QBrush(Qt::black), 0.5));
+        pt.drawPolygon(translatedPol);
+        pt.setCompositionMode(QPainter::CompositionMode_SourceIn);
+
         pt.drawPixmap(pixmap2.rect(), pixmap, pol.boundingRect());
         pt.end();
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic