author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /inputmethods/handwriting/qimpenstroke.h | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
Diffstat (limited to 'inputmethods/handwriting/qimpenstroke.h') (more/less context) (show whitespace changes)
-rw-r--r-- | inputmethods/handwriting/qimpenstroke.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/inputmethods/handwriting/qimpenstroke.h b/inputmethods/handwriting/qimpenstroke.h new file mode 100644 index 0000000..bd5ee0e --- a/dev/null +++ b/inputmethods/handwriting/qimpenstroke.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #ifndef QIMPENSTROKE_H_ | ||
22 | #define QIMPENSTROKE_H_ | ||
23 | |||
24 | #include <qobject.h> | ||
25 | #include <qarray.h> | ||
26 | #include <qlist.h> | ||
27 | |||
28 | struct Q_PACKED QIMPenGlyphLink | ||
29 | { | ||
30 | signed char dx; | ||
31 | signed char dy; | ||
32 | }; | ||
33 | |||
34 | class QIMPenStroke | ||
35 | { | ||
36 | public: | ||
37 | QIMPenStroke(); | ||
38 | QIMPenStroke( const QIMPenStroke & ); | ||
39 | |||
40 | void clear(); | ||
41 | bool isEmpty() const { return links.isEmpty(); } | ||
42 | unsigned int length() const { return links.count(); } | ||
43 | unsigned int match( QIMPenStroke *st ); | ||
44 | const QArray<QIMPenGlyphLink> &chain() const { return links; } | ||
45 | QPoint startingPoint() const { return startPoint; } | ||
46 | void setStartingPoint( const QPoint &p ) { startPoint = p; } | ||
47 | QRect boundingRect(); | ||
48 | |||
49 | QIMPenStroke &operator=( const QIMPenStroke &s ); | ||
50 | |||
51 | void beginInput( QPoint p ); | ||
52 | bool addPoint( QPoint p ); | ||
53 | void endInput(); | ||
54 | |||
55 | QArray<int> sig() { createTanSignature(); return tsig; } // for debugging | ||
56 | |||
57 | protected: | ||
58 | void createSignatures(); | ||
59 | void createTanSignature(); | ||
60 | void createAngleSignature(); | ||
61 | void createDistSignature(); | ||
62 | int calcError( const QArray<int> &base, const QArray<int> &win, | ||
63 | int off, bool t ); | ||
64 | QArray<int> scale( const QArray<int> &s, unsigned count, bool t = FALSE ); | ||
65 | void internalAddPoint( QPoint p ); | ||
66 | QPoint calcCenter(); | ||
67 | int arcTan( int dy, int dx ); | ||
68 | QArray<int> createBase( const QArray<int> a, int e ); | ||
69 | void smooth( QArray<int> &); | ||
70 | |||
71 | protected: | ||
72 | QPoint startPoint; | ||
73 | QPoint lastPoint; | ||
74 | QArray<QIMPenGlyphLink> links; | ||
75 | QArray<int> tsig; | ||
76 | QArray<int> asig; | ||
77 | QArray<int> dsig; | ||
78 | QRect bounding; | ||
79 | |||
80 | friend QDataStream &operator<< (QDataStream &, const QIMPenStroke &); | ||
81 | friend QDataStream &operator>> (QDataStream &, QIMPenStroke &); | ||
82 | }; | ||
83 | |||
84 | typedef QList<QIMPenStroke> QIMPenStrokeList; | ||
85 | typedef QListIterator<QIMPenStroke> QIMPenStrokeIterator; | ||
86 | |||
87 | QDataStream & operator<< (QDataStream & s, const QIMPenStroke &ws); | ||
88 | QDataStream & operator>> (QDataStream & s, const QIMPenStroke &ws); | ||
89 | |||
90 | #endif | ||
91 | |||