Diffstat (limited to 'noncore/graphics/drawpad/filltool.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/filltool.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/graphics/drawpad/filltool.cpp b/noncore/graphics/drawpad/filltool.cpp index 004da02..d323cc2 100644 --- a/noncore/graphics/drawpad/filltool.cpp +++ b/noncore/graphics/drawpad/filltool.cpp | |||
@@ -1,68 +1,68 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * DrawPad - a drawing program for Opie Environment * | 3 | * DrawPad - a drawing program for Opie Environment * |
4 | * * | 4 | * * |
5 | * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * | 5 | * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * |
6 | * * | 6 | * * |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | * * | 11 | * * |
12 | ***************************************************************************/ | 12 | ***************************************************************************/ |
13 | 13 | ||
14 | #include "filltool.h" | 14 | #include "filltool.h" |
15 | 15 | ||
16 | #include "drawpad.h" | 16 | #include "drawpad.h" |
17 | #include "drawpadcanvas.h" | 17 | #include "drawpadcanvas.h" |
18 | #include "page.h" | ||
18 | 19 | ||
19 | #include <qimage.h> | 20 | #include <qimage.h> |
20 | #include <qpixmap.h> | ||
21 | 21 | ||
22 | FillTool::FillTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) | 22 | FillTool::FillTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas) |
23 | : Tool(drawPad, drawPadCanvas) | 23 | : Tool(drawPad, drawPadCanvas) |
24 | { | 24 | { |
25 | } | 25 | } |
26 | 26 | ||
27 | FillTool::~FillTool() | 27 | FillTool::~FillTool() |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | void FillTool::mousePressEvent(QMouseEvent* e) | 31 | void FillTool::mousePressEvent(QMouseEvent* e) |
32 | { | 32 | { |
33 | int x = e->x(); | 33 | int x = e->x(); |
34 | int y = e->y(); | 34 | int y = e->y(); |
35 | 35 | ||
36 | m_image = m_pDrawPadCanvas->currentPage()->convertToImage(); | 36 | m_image = m_pDrawPadCanvas->currentPage()->convertToImage(); |
37 | m_fillRgb = m_pDrawPad->brush().color().rgb(); | 37 | m_fillRgb = m_pDrawPad->brush().color().rgb(); |
38 | m_oldRgb = m_image.pixel(x, y); | 38 | m_oldRgb = m_image.pixel(x, y); |
39 | 39 | ||
40 | if (m_oldRgb != m_fillRgb) { | 40 | if (m_oldRgb != m_fillRgb) { |
41 | fillLine(x, y); | 41 | fillLine(x, y); |
42 | 42 | ||
43 | m_pDrawPadCanvas->currentPage()->convertFromImage(m_image); | 43 | m_pDrawPadCanvas->currentPage()->convertFromImage(m_image); |
44 | m_pDrawPadCanvas->viewport()->update(); | 44 | m_pDrawPadCanvas->viewport()->update(); |
45 | 45 | ||
46 | m_pDrawPadCanvas->backupPage(); | 46 | m_pDrawPadCanvas->backupPage(); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | void FillTool::mouseReleaseEvent(QMouseEvent* e) | 50 | void FillTool::mouseReleaseEvent(QMouseEvent* e) |
51 | { | 51 | { |
52 | Q_UNUSED(e) | 52 | Q_UNUSED(e) |
53 | } | 53 | } |
54 | 54 | ||
55 | void FillTool::mouseMoveEvent(QMouseEvent* e) | 55 | void FillTool::mouseMoveEvent(QMouseEvent* e) |
56 | { | 56 | { |
57 | Q_UNUSED(e) | 57 | Q_UNUSED(e) |
58 | } | 58 | } |
59 | 59 | ||
60 | void FillTool::fillLine(int x, int y) | 60 | void FillTool::fillLine(int x, int y) |
61 | { | 61 | { |
62 | if ((x >= 0) && (x < m_image.width()) && (y >= 0) && (y < m_image.height())) { | 62 | if ((x >= 0) && (x < m_image.width()) && (y >= 0) && (y < m_image.height())) { |
63 | if (m_image.pixel(x, y) == m_oldRgb) { | 63 | if (m_image.pixel(x, y) == m_oldRgb) { |
64 | int x1, x2; | 64 | int x1, x2; |
65 | 65 | ||
66 | x1 = x - 1; | 66 | x1 = x - 1; |
67 | x2 = x + 1; | 67 | x2 = x + 1; |
68 | 68 | ||