Engauge Digitizer  2
DlgFilterWorker.h
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef DLG_FILTER_WORKER_H
8 #define DLG_FILTER_WORKER_H
9 
10 #include "ColorFilterMode.h"
11 #include "DlgFilterCommand.h"
12 #include <QImage>
13 #include <QList>
14 #include <QObject>
15 #include <QPixmap>
16 #include <QRgb>
17 #include <QTimer>
18 
19 typedef QList<DlgFilterCommand> FilterCommandQueue;
20 
22 class DlgFilterWorker : public QObject
23 {
24  Q_OBJECT;
25 
26 public:
28  DlgFilterWorker(const QPixmap &pixmapOriginal,
29  QRgb m_rgbBackground);
30 
31 public slots:
33  void slotNewParameters (ColorFilterMode colorFilterMode,
34  double low,
35  double high);
36 
37 private slots:
38  void slotRestartTimeout ();
39 
40 signals:
42  void signalTransferPiece (int xLeft,
43  QImage image);
44 
45 private:
47 
48  QImage m_imageOriginal; // Use QImage rather than QPixmap so we can access pixel by pixel
49  QRgb m_rgbBackground;
50 
51  FilterCommandQueue m_inputCommandQueue;
52  ColorFilterMode m_colorFilterMode; // Set when processing restarts
53  double m_low;
54  double m_high;
55 
56  int m_xLeft;
57  QTimer m_restartTimer; // Decouple slotRestartProcessing from the processing that this class performs
58 };
59 
60 #endif // DLG_FILTER_WORKER_H
void slotNewParameters(ColorFilterMode colorFilterMode, double low, double high)
Start processing with a new set of parameters. Any ongoing processing is interrupted when m_filterMod...
void signalTransferPiece(int xLeft, QImage image)
Send a processed vertical piece of the original pixmap. The destination is between xLeft and xLeft+pi...
Class for processing new filter settings. This is based on http://blog.debao.me/2013/08/how-to-use-qw...