summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad/filledellipsetool.cpp
authorleseb <leseb>2002-06-23 17:47:47 (UTC)
committer leseb <leseb>2002-06-23 17:47:47 (UTC)
commit6fd46f6d23538ec6e0f48209f6c0f0d939a2effe (patch) (unidiff)
tree2a5d407155f72dc5496d3a7d412922cc6be97e61 /noncore/graphics/drawpad/filledellipsetool.cpp
parent3251c55f854ecbd4ece8bf169177ffac28081aaa (diff)
downloadopie-6fd46f6d23538ec6e0f48209f6c0f0d939a2effe.zip
opie-6fd46f6d23538ec6e0f48209f6c0f0d939a2effe.tar.gz
opie-6fd46f6d23538ec6e0f48209f6c0f0d939a2effe.tar.bz2
Anti-aliasing as an option
Diffstat (limited to 'noncore/graphics/drawpad/filledellipsetool.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/drawpad/filledellipsetool.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/noncore/graphics/drawpad/filledellipsetool.cpp b/noncore/graphics/drawpad/filledellipsetool.cpp
index 2f7ec8f..6b5bbc6 100644
--- a/noncore/graphics/drawpad/filledellipsetool.cpp
+++ b/noncore/graphics/drawpad/filledellipsetool.cpp
@@ -29,13 +29,15 @@ FilledEllipseTool::~FilledEllipseTool()
29} 29}
30 30
31void FilledEllipseTool::drawFinalShape(QPainter& p) 31void FilledEllipseTool::drawFinalShape(QPainter& p)
32{ 32{
33 p.setRasterOp(Qt::NotROP); 33 p.setRasterOp(Qt::NotROP);
34 p.drawRect(QRect(m_polyline[2], m_polyline[0])); 34 p.drawRect(QRect(m_polyline[2], m_polyline[0]));
35 p.setRasterOp(Qt::CopyROP);
35 36
37 if (m_pDrawPad->antiAliasing()) {
36 QRect r = m_polyline.boundingRect(); 38 QRect r = m_polyline.boundingRect();
37 r = r.normalize(); 39 r = r.normalize();
38 r.setLeft(r.left() - m_pDrawPad->pen().width()); 40 r.setLeft(r.left() - m_pDrawPad->pen().width());
39 r.setTop(r.top() - m_pDrawPad->pen().width()); 41 r.setTop(r.top() - m_pDrawPad->pen().width());
40 r.setRight(r.right() + m_pDrawPad->pen().width()); 42 r.setRight(r.right() + m_pDrawPad->pen().width());
41 r.setBottom(r.bottom() + m_pDrawPad->pen().width()); 43 r.setBottom(r.bottom() + m_pDrawPad->pen().width());
@@ -62,14 +64,18 @@ void FilledEllipseTool::drawFinalShape(QPainter& p)
62 bigAreaPainter.end(); 64 bigAreaPainter.end();
63 65
64 bigAreaImage = bigAreaPixmap.convertToImage(); 66 bigAreaImage = bigAreaPixmap.convertToImage();
65 areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); 67 areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3);
66 areaPixmap.convertFromImage(areaImage); 68 areaPixmap.convertFromImage(areaImage);
67 69
68 p.setRasterOp(Qt::CopyROP);
69 p.drawPixmap(r.x(), r.y(), areaPixmap); 70 p.drawPixmap(r.x(), r.y(), areaPixmap);
71 } else {
72 p.setPen(m_pDrawPad->pen());
73 p.setBrush(m_pDrawPad->brush());
74 p.drawEllipse(QRect(m_polyline[2], m_polyline[0]));
75 }
70} 76}
71 77
72void FilledEllipseTool::drawTemporaryShape(QPainter& p) 78void FilledEllipseTool::drawTemporaryShape(QPainter& p)
73{ 79{
74 p.setRasterOp(Qt::NotROP); 80 p.setRasterOp(Qt::NotROP);
75 p.drawRect(QRect(m_polyline[2], m_polyline[1])); 81 p.drawRect(QRect(m_polyline[2], m_polyline[1]));