00001 /*************************************************************************** 00002 * * 00003 * DrawPad - a drawing program for Opie Environment * 00004 * * 00005 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 ***************************************************************************/ 00013 00014 #ifndef FILLTOOL_H 00015 #define FILLTOOL_H 00016 00017 #include "tool.h" 00018 00019 #include <qimage.h> 00020 00021 class FillTool : public Tool 00022 { 00023 public: 00024 FillTool(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas); 00025 ~FillTool(); 00026 00027 void mousePressEvent(QMouseEvent* e); 00028 void mouseReleaseEvent(QMouseEvent* e); 00029 void mouseMoveEvent(QMouseEvent* e); 00030 00031 private: 00032 void fillLine(int x, int y); 00033 void fillMaskLine(int x, int y); 00034 void setInterpolatedPixel(int x, int y); 00035 int rgbDistance(QRgb rgb1, QRgb rgb2); 00036 00037 QImage m_image; 00038 QImage m_mask; 00039 QRgb m_fillRgb; 00040 QRgb m_oldRgb; 00041 }; 00042 00043 #endif // FILLTOOL_H
1.4.2