21
21
22
22
#include " elst.h"
23
23
#include " errcode.h" // for ASSERT_HOST
24
+ #include " tesstypes.h" // for TDimension
24
25
25
26
#include < tesseract/export.h> // for DLLSYM
26
27
@@ -43,7 +44,7 @@ class ICOORD {
43
44
// / constructor
44
45
// /@param xin x value
45
46
// /@param yin y value
46
- ICOORD (int16_t xin, int16_t yin) {
47
+ ICOORD (TDimension xin, TDimension yin) {
47
48
xcoord = xin;
48
49
ycoord = yin;
49
50
}
@@ -54,20 +55,20 @@ class ICOORD {
54
55
bool Serialize (TFile *f) const ;
55
56
56
57
// / access function
57
- int16_t x () const {
58
+ TDimension x () const {
58
59
return xcoord;
59
60
}
60
61
// / access_function
61
- int16_t y () const {
62
+ TDimension y () const {
62
63
return ycoord;
63
64
}
64
65
65
66
// / rewrite function
66
- void set_x (int16_t xin) {
67
+ void set_x (TDimension xin) {
67
68
xcoord = xin; // write new value
68
69
}
69
70
// / rewrite function
70
- void set_y (int16_t yin) { // value to set
71
+ void set_y (TDimension yin) { // value to set
71
72
ycoord = yin;
72
73
}
73
74
@@ -128,15 +129,15 @@ class ICOORD {
128
129
// / cross product
129
130
friend int32_t operator *(const ICOORD &, const ICOORD &);
130
131
// / multiply
131
- friend ICOORD operator *(const ICOORD &, int16_t );
132
+ friend ICOORD operator *(const ICOORD &, TDimension );
132
133
// / multiply
133
- friend ICOORD operator *(int16_t , const ICOORD &);
134
+ friend ICOORD operator *(TDimension , const ICOORD &);
134
135
// / multiply
135
- friend ICOORD &operator *=(ICOORD &, int16_t );
136
+ friend ICOORD &operator *=(ICOORD &, TDimension );
136
137
// / divide
137
- friend ICOORD operator /(const ICOORD &, int16_t );
138
+ friend ICOORD operator /(const ICOORD &, TDimension );
138
139
// / divide
139
- friend ICOORD &operator /=(ICOORD &, int16_t );
140
+ friend ICOORD &operator /=(ICOORD &, TDimension );
140
141
// / rotate
141
142
// /@param vec by vector
142
143
void rotate (const FCOORD &vec);
@@ -155,8 +156,8 @@ class ICOORD {
155
156
bool DeSerialize (bool swap, FILE *fp);
156
157
157
158
protected:
158
- int16_t xcoord; // /< x value
159
- int16_t ycoord; // /< y value
159
+ TDimension xcoord; // /< x value
160
+ TDimension ycoord; // /< y value
160
161
};
161
162
162
163
class ICOORDELT : public ELIST_LINK ,
@@ -171,7 +172,7 @@ class ICOORDELT : public ELIST_LINK,
171
172
// / constructor
172
173
// /@param xin x value
173
174
// /@param yin y value
174
- ICOORDELT (int16_t xin, int16_t yin) {
175
+ ICOORDELT (TDimension xin, TDimension yin) {
175
176
xcoord = xin;
176
177
ycoord = yin;
177
178
}
@@ -438,7 +439,7 @@ inline int32_t operator*( // cross product
438
439
439
440
inline ICOORD operator *( // scalar multiply
440
441
const ICOORD &op1, // operands
441
- int16_t scale) {
442
+ TDimension scale) {
442
443
ICOORD result; // output
443
444
444
445
result.xcoord = op1.xcoord * scale;
@@ -447,7 +448,7 @@ inline ICOORD operator*( // scalar multiply
447
448
}
448
449
449
450
inline ICOORD operator *( // scalar multiply
450
- int16_t scale,
451
+ TDimension scale,
451
452
const ICOORD &op1 // operands
452
453
) {
453
454
ICOORD result; // output
@@ -465,7 +466,7 @@ inline ICOORD operator*( // scalar multiply
465
466
466
467
inline ICOORD &operator *=( // scalar multiply
467
468
ICOORD &op1, // operands
468
- int16_t scale) {
469
+ TDimension scale) {
469
470
op1.xcoord *= scale;
470
471
op1.ycoord *= scale;
471
472
return op1;
@@ -479,7 +480,7 @@ inline ICOORD &operator*=( // scalar multiply
479
480
480
481
inline ICOORD operator /( // scalar divide
481
482
const ICOORD &op1, // operands
482
- int16_t scale) {
483
+ TDimension scale) {
483
484
ICOORD result; // output
484
485
485
486
result.xcoord = op1.xcoord / scale;
@@ -495,7 +496,7 @@ inline ICOORD operator/( // scalar divide
495
496
496
497
inline ICOORD &operator /=( // scalar divide
497
498
ICOORD &op1, // operands
498
- int16_t scale) {
499
+ TDimension scale) {
499
500
op1.xcoord /= scale;
500
501
op1.ycoord /= scale;
501
502
return op1;
@@ -509,8 +510,8 @@ inline ICOORD &operator/=( // scalar divide
509
510
510
511
inline void ICOORD::rotate ( // rotate by vector
511
512
const FCOORD &vec) {
512
- auto tmp = static_cast <int16_t >(std::floor (xcoord * vec.x () - ycoord * vec.y () + 0 .5f ));
513
- ycoord = static_cast <int16_t >(std::floor (ycoord * vec.x () + xcoord * vec.y () + 0 .5f ));
513
+ auto tmp = static_cast <TDimension >(std::floor (xcoord * vec.x () - ycoord * vec.y () + 0 .5f ));
514
+ ycoord = static_cast <TDimension >(std::floor (ycoord * vec.x () + xcoord * vec.y () + 0 .5f ));
514
515
xcoord = tmp;
515
516
}
516
517
0 commit comments