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