aboutsummaryrefslogtreecommitdiff
path: root/stfreader.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-06-07 21:22:45 +0200
committerJavier <dev.git@javispedro.com>2015-06-07 21:22:45 +0200
commita69e97943539a8abc4d2762638c169dc19c88516 (patch)
treef3516ea29745db65971247cee4c260b49f1067b2 /stfreader.h
downloadscribiu-a69e97943539a8abc4d2762638c169dc19c88516.tar.gz
scribiu-a69e97943539a8abc4d2762638c169dc19c88516.zip
initial import
Diffstat (limited to 'stfreader.h')
-rw-r--r--stfreader.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/stfreader.h b/stfreader.h
new file mode 100644
index 0000000..06013e1
--- /dev/null
+++ b/stfreader.h
@@ -0,0 +1,51 @@
+#ifndef STFREADER_H
+#define STFREADER_H
+
+#include <QtCore/QPoint>
+#include "bitreader.h"
+
+class StfReader
+{
+public:
+ class StrokeHandler
+ {
+ public:
+ virtual ~StrokeHandler();
+ virtual bool startStroke(const QPoint& p, int force, quint64 time) = 0;
+ virtual bool strokePoint(const QPoint& p, int force, quint64 time) = 0;
+ virtual bool endStroke() = 0;
+ };
+
+protected:
+ struct CodeTable {
+ int bits;
+ int size;
+ qint8 * data;
+ };
+
+ StrokeHandler *handler;
+ int speed;
+
+ bool parseV1(BitReader& br);
+ void syncV1(BitReader& br);
+ qint8 decodeV1(BitReader& br, CodeTable* tab, int tab_size);
+
+ qint8 readForce(BitReader& br);
+ qint8 readHeader(BitReader& br);
+ qint8 readHeader2(BitReader& br);
+ qint8 readHeader3(BitReader& br);
+ qint8 readTime(BitReader& br);
+ qint8 readDeltaX(BitReader& br);
+ qint8 readDeltaY(BitReader& br);
+ qint8 readDeltaF(BitReader& br);
+
+public:
+ StfReader();
+ ~StfReader();
+
+ bool parse(QIODevice *device);
+ bool parse(const QString &filename);
+ void setStrokeHandler(StrokeHandler *newHandler);
+};
+
+#endif // STFREADER_H