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; |
| 14 class CBC_QRDetectorResult; |
| 15 class CBC_ResultPoint; |
13 class CBC_WhiteRectangleDetector; | 16 class CBC_WhiteRectangleDetector; |
14 class CBC_ResultPoint; | 17 |
15 class CBC_QRDetectorResult; | |
16 class CBC_DataMatrixDetector; | |
17 class ResultPointsAndTransitions; | |
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 m_from = from; |
24 m_to = to; | 24 m_to = to; |
25 m_transitions = transitions; | 25 m_transitions = transitions; |
26 } | 26 } |
27 ~CBC_ResultPointsAndTransitions() {} | 27 ~CBC_ResultPointsAndTransitions() {} |
28 CBC_ResultPoint* GetFrom() { return m_from; } | 28 CBC_ResultPoint* GetFrom() const { return m_from; } |
29 CBC_ResultPoint* GetTo() { return m_to; } | 29 CBC_ResultPoint* GetTo() const { return m_to; } |
30 int32_t GetTransitions() { return m_transitions; } | 30 int32_t GetTransitions() const { return m_transitions; } |
31 | 31 |
32 private: | 32 private: |
33 CBC_ResultPoint* m_from; | 33 CBC_ResultPoint* m_from; |
34 CBC_ResultPoint* m_to; | 34 CBC_ResultPoint* m_to; |
35 int32_t m_transitions; | 35 int32_t m_transitions; |
36 }; | 36 }; |
| 37 |
37 class CBC_DataMatrixDetector { | 38 class CBC_DataMatrixDetector { |
38 public: | 39 public: |
39 CBC_DataMatrixDetector(CBC_CommonBitMatrix* image); | 40 CBC_DataMatrixDetector(CBC_CommonBitMatrix* image); |
40 virtual ~CBC_DataMatrixDetector(); | 41 virtual ~CBC_DataMatrixDetector(); |
41 CBC_QRDetectorResult* Detect(int32_t& e); | 42 CBC_QRDetectorResult* Detect(int32_t& e); |
42 CBC_ResultPoint* CorrectTopRightRectangular(CBC_ResultPoint* bottomLeft, | 43 CBC_ResultPoint* CorrectTopRightRectangular(CBC_ResultPoint* bottomLeft, |
43 CBC_ResultPoint* bottomRight, | 44 CBC_ResultPoint* bottomRight, |
44 CBC_ResultPoint* topLeft, | 45 CBC_ResultPoint* topLeft, |
45 CBC_ResultPoint* topRight, | 46 CBC_ResultPoint* topRight, |
46 int32_t dimensionTop, | 47 int32_t dimensionTop, |
(...skipping 11 matching lines...) Expand all Loading... |
58 int32_t dimensionX, | 59 int32_t dimensionX, |
59 int32_t dimensionY, | 60 int32_t dimensionY, |
60 int32_t& e); | 61 int32_t& e); |
61 CBC_ResultPointsAndTransitions* TransitionsBetween(CBC_ResultPoint* from, | 62 CBC_ResultPointsAndTransitions* TransitionsBetween(CBC_ResultPoint* from, |
62 CBC_ResultPoint* to); | 63 CBC_ResultPoint* to); |
63 FX_BOOL IsValid(CBC_ResultPoint* p); | 64 FX_BOOL IsValid(CBC_ResultPoint* p); |
64 int32_t Distance(CBC_ResultPoint* a, CBC_ResultPoint* b); | 65 int32_t Distance(CBC_ResultPoint* a, CBC_ResultPoint* b); |
65 void Increment(CFX_MapPtrTemplate<CBC_ResultPoint*, int32_t>& table, | 66 void Increment(CFX_MapPtrTemplate<CBC_ResultPoint*, int32_t>& table, |
66 CBC_ResultPoint* key); | 67 CBC_ResultPoint* key); |
67 int32_t Round(FX_FLOAT d); | 68 int32_t Round(FX_FLOAT d); |
68 void OrderBestPatterns(CFX_PtrArray* patterns); | 69 void OrderBestPatterns(CFX_ArrayTemplate<CBC_ResultPoint*>* patterns); |
69 virtual void Init(int32_t& e); | 70 virtual void Init(int32_t& e); |
70 | 71 |
71 private: | 72 private: |
72 static const int32_t INTEGERS[5]; | 73 static const int32_t INTEGERS[5]; |
73 | 74 |
74 CBC_CommonBitMatrix* m_image; | 75 CBC_CommonBitMatrix* m_image; |
75 CBC_WhiteRectangleDetector* m_rectangleDetector; | 76 CBC_WhiteRectangleDetector* m_rectangleDetector; |
76 }; | 77 }; |
77 | 78 |
78 #endif // XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXDETECTOR_H_ | 79 #endif // XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXDETECTOR_H_ |
OLD | NEW |