summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad/linetool.cpp
blob: 94ca165b212fb53e4af82f06fbd6d97e7a1858c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/***************************************************************************
 *                                                                         *
 *   DrawPad - a drawing program for Opie Environment                      *
 *                                                                         *
 *   (C) 2002 by S. Prud'homme <prudhomme@laposte.net>                     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "linetool.h"

#include "drawpad.h"
#include "drawpadcanvas.h"

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.setPen(m_pDrawPad->pen());
    p.setRasterOp(Qt::CopyROP);
    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]);
}