Engauge Digitizer  2
DlgFilterWorker.h
1 #ifndef DLG_FILTER_WORKER_H
2 #define DLG_FILTER_WORKER_H
3 
4 #include "ColorFilterMode.h"
5 #include "DlgFilterCommand.h"
6 #include <QImage>
7 #include <QList>
8 #include <QObject>
9 #include <QPixmap>
10 #include <QRgb>
11 #include <QTimer>
12 
13 typedef QList<DlgFilterCommand> FilterCommandQueue;
14 
16 class DlgFilterWorker : public QObject
17 {
18  Q_OBJECT;
19 
20 public:
22  DlgFilterWorker(const QPixmap &pixmapOriginal,
23  QRgb m_rgbBackground);
24 
25 public slots:
27  void slotNewParameters (ColorFilterMode colorFilterMode,
28  double low,
29  double high);
30 
31 private slots:
32  void slotRestartTimeout ();
33 
34 signals:
36  void signalTransferPiece (int xLeft,
37  QImage image);
38 
39 private:
41 
42  QImage m_imageOriginal; // Use QImage rather than QPixmap so we can access pixel by pixel
43  QRgb m_rgbBackground;
44 
45  FilterCommandQueue m_inputCommandQueue;
46  ColorFilterMode m_colorFilterMode; // Set when processing restarts
47  double m_low;
48  double m_high;
49 
50  int m_xLeft;
51  QTimer m_restartTimer; // Decouple slotRestartProcessing from the processing that this class performs
52 };
53 
54 #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...