author | leseb <leseb> | 2002-06-23 17:47:47 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-23 17:47:47 (UTC) |
commit | 6fd46f6d23538ec6e0f48209f6c0f0d939a2effe (patch) (side-by-side diff) | |
tree | 2a5d407155f72dc5496d3a7d412922cc6be97e61 /noncore/graphics/drawpad | |
parent | 3251c55f854ecbd4ece8bf169177ffac28081aaa (diff) | |
download | opie-6fd46f6d23538ec6e0f48209f6c0f0d939a2effe.zip opie-6fd46f6d23538ec6e0f48209f6c0f0d939a2effe.tar.gz opie-6fd46f6d23538ec6e0f48209f6c0f0d939a2effe.tar.bz2 |
Anti-aliasing as an option
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 13 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 4 | ||||
-rw-r--r-- | noncore/graphics/drawpad/ellipsetool.cpp | 57 | ||||
-rw-r--r-- | noncore/graphics/drawpad/filledellipsetool.cpp | 60 | ||||
-rw-r--r-- | noncore/graphics/drawpad/linetool.cpp | 55 | ||||
-rw-r--r-- | noncore/graphics/drawpad/pointtool.cpp | 54 |
6 files changed, 140 insertions, 103 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 45fb886..b29f5ba 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp @@ -58,25 +58,25 @@ DrawPad::DrawPad(QWidget* parent, const char* name) connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateCaption())); connect(m_pDrawPadCanvas, SIGNAL(pageBackupsChanged()), this, SLOT(updateUndoRedoToolButtons())); setCentralWidget(m_pDrawPadCanvas); // init menu setToolBarsMovable(false); QPEToolBar* menuToolBar = new QPEToolBar(this); QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar); - QPopupMenu *toolsPopupMenu = new QPopupMenu(menuBar); + QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); deleteAllAction->addTo(toolsPopupMenu); toolsPopupMenu->insertSeparator(); QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); importPageAction->addTo(toolsPopupMenu); QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); @@ -84,24 +84,30 @@ DrawPad::DrawPad(QWidget* parent, const char* name) exportPageAction->addTo(toolsPopupMenu); toolsPopupMenu->insertSeparator(); QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); thumbnailViewAction->addTo(toolsPopupMenu); QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); pageInformationAction->addTo(toolsPopupMenu); + toolsPopupMenu->insertSeparator(); + + m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); + m_pAntiAliasingAction->setToggleAction(true); + m_pAntiAliasingAction->addTo(toolsPopupMenu); + menuBar->insertItem(tr("Tools"), toolsPopupMenu); // init page toolbar QPEToolBar* pageToolBar = new QPEToolBar(this); QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this); connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); newPageAction->addTo(pageToolBar); QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); @@ -266,24 +272,29 @@ DrawPad::DrawPad(QWidget* parent, const char* name) } DrawPad::~DrawPad() { QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); if (file.open(IO_WriteOnly)) { m_pDrawPadCanvas->save(&file); file.close(); } } +bool DrawPad::antiAliasing() +{ + return (m_pAntiAliasingAction->isOn()); +} + void DrawPad::newPage() { QRect rect = m_pDrawPadCanvas->contentsRect(); NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); if (newPageDialog.exec() == QDialog::Accepted) { m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), newPageDialog.selectedColor()); } } diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index ce62802..8e29c61 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h @@ -29,24 +29,26 @@ class QWidgetStack; class DrawPad : public QMainWindow { Q_OBJECT public: DrawPad(QWidget* parent = 0, const char* name = 0); ~DrawPad(); Tool* tool() { return m_pTool; } QPen pen() { return m_pen; } QBrush brush() { return m_brush; } + bool antiAliasing(); + private slots: void newPage(); void clearPage(); void deletePage(); void setPointTool(); void setLineTool(); void setRectangleTool(); void setFilledRectangleTool(); void setEllipseTool(); void setFilledEllipseTool(); void setTextTool(); @@ -65,24 +67,26 @@ private slots: void importPage(); void exportPage(); void thumbnailView(); void pageInformation(); private: DrawPadCanvas* m_pDrawPadCanvas; Tool* m_pTool; QPen m_pen; QBrush m_brush; + QAction* m_pAntiAliasingAction; + QAction* m_pUndoAction; QAction* m_pRedoAction; QAction* m_pFirstPageAction; QAction* m_pPreviousPageAction; QAction* m_pNextPageAction; QAction* m_pLastPageAction; QAction* m_pPointToolAction; QAction* m_pLineToolAction; QAction* m_pRectangleToolAction; QAction* m_pFilledRectangleToolAction; diff --git a/noncore/graphics/drawpad/ellipsetool.cpp b/noncore/graphics/drawpad/ellipsetool.cpp index 733bade..0cdb731 100644 --- a/noncore/graphics/drawpad/ellipsetool.cpp +++ b/noncore/graphics/drawpad/ellipsetool.cpp @@ -23,54 +23,59 @@ EllipseTool::EllipseTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) : ShapeTool(drawPad, drawPadCanvas) { } EllipseTool::~EllipseTool() { } void EllipseTool::drawFinalShape(QPainter& p) { p.setRasterOp(Qt::NotROP); p.drawRect(QRect(m_polyline[2], m_polyline[0])); + p.setRasterOp(Qt::CopyROP); - QRect r = m_polyline.boundingRect(); - r = r.normalize(); - r.setLeft(r.left() - m_pDrawPad->pen().width()); - r.setTop(r.top() - m_pDrawPad->pen().width()); - r.setRight(r.right() + m_pDrawPad->pen().width()); - r.setBottom(r.bottom() + m_pDrawPad->pen().width()); + if (m_pDrawPad->antiAliasing()) { + QRect r = m_polyline.boundingRect(); + r = r.normalize(); + r.setLeft(r.left() - m_pDrawPad->pen().width()); + r.setTop(r.top() - m_pDrawPad->pen().width()); + r.setRight(r.right() + m_pDrawPad->pen().width()); + r.setBottom(r.bottom() + m_pDrawPad->pen().width()); - QPixmap areaPixmap(r.width(), r.height()); - bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); + QPixmap areaPixmap(r.width(), r.height()); + bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); - QImage areaImage = areaPixmap.convertToImage(); - QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); + QImage areaImage = areaPixmap.convertToImage(); + QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); - QPixmap bigAreaPixmap; - bigAreaPixmap.convertFromImage(bigAreaImage); + QPixmap bigAreaPixmap; + bigAreaPixmap.convertFromImage(bigAreaImage); - QPen bigAreaPen = m_pDrawPad->pen(); - bigAreaPen.setWidth(bigAreaPen.width() * 3); + QPen bigAreaPen = m_pDrawPad->pen(); + bigAreaPen.setWidth(bigAreaPen.width() * 3); - QPainter bigAreaPainter; - bigAreaPainter.begin(&bigAreaPixmap); - bigAreaPainter.setPen(bigAreaPen); - bigAreaPainter.drawEllipse(QRect(bigAreaPen.width() + 1, bigAreaPen.width() + 1, - bigAreaPixmap.width() - 2 * (bigAreaPen.width() + 1), - bigAreaPixmap.height() - 2 * (bigAreaPen.width() + 1))); - bigAreaPainter.end(); + QPainter bigAreaPainter; + bigAreaPainter.begin(&bigAreaPixmap); + bigAreaPainter.setPen(bigAreaPen); + bigAreaPainter.drawEllipse(QRect(bigAreaPen.width() + 1, bigAreaPen.width() + 1, + bigAreaPixmap.width() - 2 * (bigAreaPen.width() + 1), + bigAreaPixmap.height() - 2 * (bigAreaPen.width() + 1))); + bigAreaPainter.end(); - bigAreaImage = bigAreaPixmap.convertToImage(); - areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); - areaPixmap.convertFromImage(areaImage); + bigAreaImage = bigAreaPixmap.convertToImage(); + areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); + areaPixmap.convertFromImage(areaImage); - p.setRasterOp(Qt::CopyROP); - p.drawPixmap(r.x(), r.y(), areaPixmap); + p.drawPixmap(r.x(), r.y(), areaPixmap); + } else { + p.setPen(m_pDrawPad->pen()); + p.drawEllipse(QRect(m_polyline[2], m_polyline[0])); + } } void EllipseTool::drawTemporaryShape(QPainter& p) { p.setRasterOp(Qt::NotROP); p.drawRect(QRect(m_polyline[2], m_polyline[1])); p.drawRect(QRect(m_polyline[2], m_polyline[0])); } 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 @@ -23,55 +23,61 @@ FilledEllipseTool::FilledEllipseTool(DrawPad* drawPad, DrawPadCanvas* drawPadCan : ShapeTool(drawPad, drawPadCanvas) { } FilledEllipseTool::~FilledEllipseTool() { } void FilledEllipseTool::drawFinalShape(QPainter& p) { p.setRasterOp(Qt::NotROP); p.drawRect(QRect(m_polyline[2], m_polyline[0])); + p.setRasterOp(Qt::CopyROP); - QRect r = m_polyline.boundingRect(); - r = r.normalize(); - r.setLeft(r.left() - m_pDrawPad->pen().width()); - r.setTop(r.top() - m_pDrawPad->pen().width()); - r.setRight(r.right() + m_pDrawPad->pen().width()); - r.setBottom(r.bottom() + m_pDrawPad->pen().width()); + if (m_pDrawPad->antiAliasing()) { + QRect r = m_polyline.boundingRect(); + r = r.normalize(); + r.setLeft(r.left() - m_pDrawPad->pen().width()); + r.setTop(r.top() - m_pDrawPad->pen().width()); + r.setRight(r.right() + m_pDrawPad->pen().width()); + r.setBottom(r.bottom() + m_pDrawPad->pen().width()); - QPixmap areaPixmap(r.width(), r.height()); - bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); + QPixmap areaPixmap(r.width(), r.height()); + bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); - QImage areaImage = areaPixmap.convertToImage(); - QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); + QImage areaImage = areaPixmap.convertToImage(); + QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); - QPixmap bigAreaPixmap; - bigAreaPixmap.convertFromImage(bigAreaImage); + QPixmap bigAreaPixmap; + bigAreaPixmap.convertFromImage(bigAreaImage); - QPen bigAreaPen = m_pDrawPad->pen(); - bigAreaPen.setWidth(bigAreaPen.width() * 3); + QPen bigAreaPen = m_pDrawPad->pen(); + bigAreaPen.setWidth(bigAreaPen.width() * 3); - QPainter bigAreaPainter; - bigAreaPainter.begin(&bigAreaPixmap); - bigAreaPainter.setPen(bigAreaPen); - bigAreaPainter.setBrush(m_pDrawPad->brush()); - bigAreaPainter.drawEllipse(QRect(bigAreaPen.width() + 1, bigAreaPen.width() + 1, - bigAreaPixmap.width() - 2 * (bigAreaPen.width() + 1), - bigAreaPixmap.height() - 2 * (bigAreaPen.width() + 1))); - bigAreaPainter.end(); + QPainter bigAreaPainter; + bigAreaPainter.begin(&bigAreaPixmap); + bigAreaPainter.setPen(bigAreaPen); + bigAreaPainter.setBrush(m_pDrawPad->brush()); + bigAreaPainter.drawEllipse(QRect(bigAreaPen.width() + 1, bigAreaPen.width() + 1, + bigAreaPixmap.width() - 2 * (bigAreaPen.width() + 1), + bigAreaPixmap.height() - 2 * (bigAreaPen.width() + 1))); + bigAreaPainter.end(); - bigAreaImage = bigAreaPixmap.convertToImage(); - areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); - areaPixmap.convertFromImage(areaImage); + bigAreaImage = bigAreaPixmap.convertToImage(); + areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); + areaPixmap.convertFromImage(areaImage); - p.setRasterOp(Qt::CopyROP); - p.drawPixmap(r.x(), r.y(), areaPixmap); + p.drawPixmap(r.x(), r.y(), areaPixmap); + } else { + p.setPen(m_pDrawPad->pen()); + p.setBrush(m_pDrawPad->brush()); + p.drawEllipse(QRect(m_polyline[2], m_polyline[0])); + } } void FilledEllipseTool::drawTemporaryShape(QPainter& p) { p.setRasterOp(Qt::NotROP); p.drawRect(QRect(m_polyline[2], m_polyline[1])); p.drawRect(QRect(m_polyline[2], m_polyline[0])); } diff --git a/noncore/graphics/drawpad/linetool.cpp b/noncore/graphics/drawpad/linetool.cpp index 99cd6de..b6baa2a 100644 --- a/noncore/graphics/drawpad/linetool.cpp +++ b/noncore/graphics/drawpad/linetool.cpp @@ -23,55 +23,60 @@ LineTool::LineTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) : ShapeTool(drawPad, drawPadCanvas) { } LineTool::~LineTool() { } void LineTool::drawFinalShape(QPainter& p) { p.setRasterOp(Qt::NotROP); p.drawLine(m_polyline[2], m_polyline[0]); + p.setRasterOp(Qt::CopyROP); - QRect r = m_polyline.boundingRect(); - r = r.normalize(); - r.setLeft(r.left() - m_pDrawPad->pen().width()); - r.setTop(r.top() - m_pDrawPad->pen().width()); - r.setRight(r.right() + m_pDrawPad->pen().width()); - r.setBottom(r.bottom() + m_pDrawPad->pen().width()); + if (m_pDrawPad->antiAliasing()) { + QRect r = m_polyline.boundingRect(); + r = r.normalize(); + r.setLeft(r.left() - m_pDrawPad->pen().width()); + r.setTop(r.top() - m_pDrawPad->pen().width()); + r.setRight(r.right() + m_pDrawPad->pen().width()); + r.setBottom(r.bottom() + m_pDrawPad->pen().width()); - QPixmap areaPixmap(r.width(), r.height()); - bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); + QPixmap areaPixmap(r.width(), r.height()); + bitBlt(&areaPixmap, QPoint(0, 0), p.device(), r); - QImage areaImage = areaPixmap.convertToImage(); - QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); + QImage areaImage = areaPixmap.convertToImage(); + QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); - QPixmap bigAreaPixmap; - bigAreaPixmap.convertFromImage(bigAreaImage); + QPixmap bigAreaPixmap; + bigAreaPixmap.convertFromImage(bigAreaImage); - QPen bigAreaPen = m_pDrawPad->pen(); - bigAreaPen.setWidth(bigAreaPen.width() * 3); + QPen bigAreaPen = m_pDrawPad->pen(); + bigAreaPen.setWidth(bigAreaPen.width() * 3); - QPainter bigAreaPainter; - bigAreaPainter.begin(&bigAreaPixmap); - bigAreaPainter.setPen(bigAreaPen); + QPainter bigAreaPainter; + bigAreaPainter.begin(&bigAreaPixmap); + bigAreaPainter.setPen(bigAreaPen); - bigAreaPainter.drawLine((m_polyline[2].x() - r.x()) * 3 + 1, (m_polyline[2].y() - r.y()) * 3 + 1, - (m_polyline[0].x() - r.x()) * 3 + 1, (m_polyline[0].y() - r.y()) * 3 + 1); + bigAreaPainter.drawLine((m_polyline[2].x() - r.x()) * 3 + 1, (m_polyline[2].y() - r.y()) * 3 + 1, + (m_polyline[0].x() - r.x()) * 3 + 1, (m_polyline[0].y() - r.y()) * 3 + 1); - bigAreaPainter.end(); + bigAreaPainter.end(); - bigAreaImage = bigAreaPixmap.convertToImage(); - areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); - areaPixmap.convertFromImage(areaImage); + bigAreaImage = bigAreaPixmap.convertToImage(); + areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); + areaPixmap.convertFromImage(areaImage); - p.setRasterOp(Qt::CopyROP); - p.drawPixmap(r.x(), r.y(), areaPixmap); + p.drawPixmap(r.x(), r.y(), areaPixmap); + } else { + p.setPen(m_pDrawPad->pen()); + p.drawLine(m_polyline[2], m_polyline[0]); + } } void LineTool::drawTemporaryShape(QPainter& p) { p.setRasterOp(Qt::NotROP); p.drawLine(m_polyline[2], m_polyline[1]); p.drawLine(m_polyline[2], m_polyline[0]); } diff --git a/noncore/graphics/drawpad/pointtool.cpp b/noncore/graphics/drawpad/pointtool.cpp index 22bb089..a4f846e 100644 --- a/noncore/graphics/drawpad/pointtool.cpp +++ b/noncore/graphics/drawpad/pointtool.cpp @@ -44,62 +44,68 @@ void PointTool::mouseReleaseEvent(QMouseEvent* e) m_mousePressed = false; m_pDrawPadCanvas->backupPage(); } void PointTool::mouseMoveEvent(QMouseEvent* e) { if (m_mousePressed) { m_polyline[2] = m_polyline[1]; m_polyline[1] = m_polyline[0]; m_polyline[0] = e->pos(); - QPainter painter; - painter.begin(m_pDrawPadCanvas->currentPage()); - QRect r = m_polyline.boundingRect(); r = r.normalize(); r.setLeft(r.left() - m_pDrawPad->pen().width()); r.setTop(r.top() - m_pDrawPad->pen().width()); r.setRight(r.right() + m_pDrawPad->pen().width()); r.setBottom(r.bottom() + m_pDrawPad->pen().width()); - QPixmap areaPixmap(r.width(), r.height()); - bitBlt(&areaPixmap, QPoint(0, 0), painter.device(), r); + QPainter painter; + painter.begin(m_pDrawPadCanvas->currentPage()); + + if (m_pDrawPad->antiAliasing()) { + QPixmap areaPixmap(r.width(), r.height()); + bitBlt(&areaPixmap, QPoint(0, 0), painter.device(), r); + + QImage areaImage = areaPixmap.convertToImage(); + QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); - QImage areaImage = areaPixmap.convertToImage(); - QImage bigAreaImage = areaImage.smoothScale(areaImage.width() * 3, areaImage.height() * 3); + QPixmap bigAreaPixmap; + bigAreaPixmap.convertFromImage(bigAreaImage); - QPixmap bigAreaPixmap; - bigAreaPixmap.convertFromImage(bigAreaImage); + QPen bigAreaPen = m_pDrawPad->pen(); + bigAreaPen.setWidth(bigAreaPen.width() * 3); - QPen bigAreaPen = m_pDrawPad->pen(); - bigAreaPen.setWidth(bigAreaPen.width() * 3); + QPainter bigAreaPainter; + bigAreaPainter.begin(&bigAreaPixmap); + bigAreaPainter.setPen(bigAreaPen); - QPainter bigAreaPainter; - bigAreaPainter.begin(&bigAreaPixmap); - bigAreaPainter.setPen(bigAreaPen); + QPointArray bigAreaPolyline(3); + bigAreaPolyline.setPoint(0, (m_polyline[0].x() - r.x()) * 3 + 1, (m_polyline[0].y() - r.y()) * 3 + 1); + bigAreaPolyline.setPoint(1, (m_polyline[1].x() - r.x()) * 3 + 1, (m_polyline[1].y() - r.y()) * 3 + 1); + bigAreaPolyline.setPoint(2, (m_polyline[2].x() - r.x()) * 3 + 1, (m_polyline[2].y() - r.y()) * 3 + 1); - QPointArray bigAreaPolyline(3); - bigAreaPolyline.setPoint(0, (m_polyline[0].x() - r.x()) * 3 + 1, (m_polyline[0].y() - r.y()) * 3 + 1); - bigAreaPolyline.setPoint(1, (m_polyline[1].x() - r.x()) * 3 + 1, (m_polyline[1].y() - r.y()) * 3 + 1); - bigAreaPolyline.setPoint(2, (m_polyline[2].x() - r.x()) * 3 + 1, (m_polyline[2].y() - r.y()) * 3 + 1); + bigAreaPainter.drawPolyline(bigAreaPolyline); + bigAreaPainter.end(); - bigAreaPainter.drawPolyline(bigAreaPolyline); - bigAreaPainter.end(); + bigAreaImage = bigAreaPixmap.convertToImage(); + areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); + areaPixmap.convertFromImage(areaImage); - bigAreaImage = bigAreaPixmap.convertToImage(); - areaImage = bigAreaImage.smoothScale(bigAreaImage.width() / 3, bigAreaImage.height() / 3); - areaPixmap.convertFromImage(areaImage); + painter.drawPixmap(r.x(), r.y(), areaPixmap); + } else { + painter.setPen(m_pDrawPad->pen()); + painter.drawPolyline(m_polyline); + } - painter.drawPixmap(r.x(), r.y(), areaPixmap); painter.end(); QRect viewportRect(m_pDrawPadCanvas->contentsToViewport(r.topLeft()), m_pDrawPadCanvas->contentsToViewport(r.bottomRight())); bitBlt(m_pDrawPadCanvas->viewport(), viewportRect.x(), viewportRect.y(), m_pDrawPadCanvas->currentPage(), r.x(), r.y(), r.width(), r.height()); m_pDrawPadCanvas->viewport()->update(viewportRect); } } |