OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXDETECTOR_H_ | 7 #ifndef XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXDETECTOR_H_ |
8 #define XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXDETECTOR_H_ | 8 #define XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXDETECTOR_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
11 | 11 |
12 class CBC_CommonBitMatrix; | 12 class CBC_CommonBitMatrix; |
13 class CBC_DataMatrixDetector; | 13 class CBC_DataMatrixDetector; |
14 class CBC_QRDetectorResult; | 14 class CBC_QRDetectorResult; |
15 class CBC_ResultPoint; | 15 class CBC_ResultPoint; |
16 class CBC_WhiteRectangleDetector; | 16 class CBC_WhiteRectangleDetector; |
17 | 17 |
18 class CBC_ResultPointsAndTransitions { | 18 class CBC_ResultPointsAndTransitions { |
19 public: | 19 public: |
20 CBC_ResultPointsAndTransitions(CBC_ResultPoint* from, | 20 CBC_ResultPointsAndTransitions(CBC_ResultPoint* from, |
21 CBC_ResultPoint* to, | 21 CBC_ResultPoint* to, |
22 int32_t transitions) { | 22 int32_t transitions); |
23 m_from = from; | 23 ~CBC_ResultPointsAndTransitions(); |
24 m_to = to; | 24 |
25 m_transitions = transitions; | |
26 } | |
27 ~CBC_ResultPointsAndTransitions() {} | |
28 CBC_ResultPoint* GetFrom() const { return m_from; } | 25 CBC_ResultPoint* GetFrom() const { return m_from; } |
29 CBC_ResultPoint* GetTo() const { return m_to; } | 26 CBC_ResultPoint* GetTo() const { return m_to; } |
30 int32_t GetTransitions() const { return m_transitions; } | 27 int32_t GetTransitions() const { return m_transitions; } |
31 | 28 |
32 private: | 29 private: |
33 CBC_ResultPoint* m_from; | 30 CBC_ResultPoint* m_from; |
34 CBC_ResultPoint* m_to; | 31 CBC_ResultPoint* m_to; |
35 int32_t m_transitions; | 32 int32_t m_transitions; |
36 }; | 33 }; |
37 | 34 |
38 class CBC_DataMatrixDetector { | 35 class CBC_DataMatrixDetector { |
39 public: | 36 public: |
40 CBC_DataMatrixDetector(CBC_CommonBitMatrix* image); | 37 CBC_DataMatrixDetector(CBC_CommonBitMatrix* image); |
41 virtual ~CBC_DataMatrixDetector(); | 38 virtual ~CBC_DataMatrixDetector(); |
| 39 |
42 CBC_QRDetectorResult* Detect(int32_t& e); | 40 CBC_QRDetectorResult* Detect(int32_t& e); |
43 CBC_ResultPoint* CorrectTopRightRectangular(CBC_ResultPoint* bottomLeft, | 41 CBC_ResultPoint* CorrectTopRightRectangular(CBC_ResultPoint* bottomLeft, |
44 CBC_ResultPoint* bottomRight, | 42 CBC_ResultPoint* bottomRight, |
45 CBC_ResultPoint* topLeft, | 43 CBC_ResultPoint* topLeft, |
46 CBC_ResultPoint* topRight, | 44 CBC_ResultPoint* topRight, |
47 int32_t dimensionTop, | 45 int32_t dimensionTop, |
48 int32_t dimensionRight); | 46 int32_t dimensionRight); |
49 CBC_ResultPoint* CorrectTopRight(CBC_ResultPoint* bottomLeft, | 47 CBC_ResultPoint* CorrectTopRight(CBC_ResultPoint* bottomLeft, |
50 CBC_ResultPoint* bottomRight, | 48 CBC_ResultPoint* bottomRight, |
51 CBC_ResultPoint* topLeft, | 49 CBC_ResultPoint* topLeft, |
52 CBC_ResultPoint* topRight, | 50 CBC_ResultPoint* topRight, |
53 int32_t dimension); | 51 int32_t dimension); |
54 CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix* image, | 52 CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix* image, |
55 CBC_ResultPoint* topLeft, | 53 CBC_ResultPoint* topLeft, |
56 CBC_ResultPoint* bottomLeft, | 54 CBC_ResultPoint* bottomLeft, |
57 CBC_ResultPoint* bottomRight, | 55 CBC_ResultPoint* bottomRight, |
58 CBC_ResultPoint* topRight, | 56 CBC_ResultPoint* topRight, |
59 int32_t dimensionX, | 57 int32_t dimensionX, |
60 int32_t dimensionY, | 58 int32_t dimensionY, |
61 int32_t& e); | 59 int32_t& e); |
62 CBC_ResultPointsAndTransitions* TransitionsBetween(CBC_ResultPoint* from, | 60 CBC_ResultPointsAndTransitions* TransitionsBetween(CBC_ResultPoint* from, |
63 CBC_ResultPoint* to); | 61 CBC_ResultPoint* to); |
64 FX_BOOL IsValid(CBC_ResultPoint* p); | 62 FX_BOOL IsValid(CBC_ResultPoint* p); |
65 int32_t Distance(CBC_ResultPoint* a, CBC_ResultPoint* b); | 63 int32_t Distance(CBC_ResultPoint* a, CBC_ResultPoint* b); |
66 void Increment(CFX_MapPtrTemplate<CBC_ResultPoint*, int32_t>& table, | 64 void Increment(CFX_MapPtrTemplate<CBC_ResultPoint*, int32_t>& table, |
67 CBC_ResultPoint* key); | 65 CBC_ResultPoint* key); |
68 int32_t Round(FX_FLOAT d); | 66 int32_t Round(FX_FLOAT d); |
69 void OrderBestPatterns(CFX_ArrayTemplate<CBC_ResultPoint*>* patterns); | 67 void OrderBestPatterns(CFX_ArrayTemplate<CBC_ResultPoint*>* patterns); |
| 68 |
70 virtual void Init(int32_t& e); | 69 virtual void Init(int32_t& e); |
71 | 70 |
72 private: | 71 private: |
73 static const int32_t INTEGERS[5]; | 72 static const int32_t INTEGERS[5]; |
74 | 73 |
75 CBC_CommonBitMatrix* m_image; | 74 CBC_CommonBitMatrix* m_image; |
76 CBC_WhiteRectangleDetector* m_rectangleDetector; | 75 CBC_WhiteRectangleDetector* m_rectangleDetector; |
77 }; | 76 }; |
78 | 77 |
79 #endif // XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXDETECTOR_H_ | 78 #endif // XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXDETECTOR_H_ |
OLD | NEW |