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_COMMON_BC_WHITERECTANGLEDETECTOR_H_ | 7 #ifndef XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ |
8 #define XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ | 8 #define XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_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_ResultPoint; | 13 class CBC_ResultPoint; |
14 | 14 |
15 class CBC_WhiteRectangleDetector { | 15 class CBC_WhiteRectangleDetector { |
16 public: | 16 public: |
17 CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image); | 17 CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image); |
18 CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image, | 18 CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image, |
19 int32_t initSize, | 19 int32_t initSize, |
20 int32_t x, | 20 int32_t x, |
21 int32_t y); | 21 int32_t y); |
22 virtual ~CBC_WhiteRectangleDetector(); | 22 virtual ~CBC_WhiteRectangleDetector(); |
23 CFX_PtrArray* Detect(int32_t& e); | |
24 virtual void Init(int32_t& e); | 23 virtual void Init(int32_t& e); |
25 | 24 |
| 25 CFX_ArrayTemplate<CBC_ResultPoint*>* Detect(int32_t& e); |
| 26 |
26 private: | 27 private: |
27 int32_t Round(float d); | 28 int32_t Round(float d); |
28 CBC_ResultPoint* GetBlackPointOnSegment(FX_FLOAT aX, | 29 CBC_ResultPoint* GetBlackPointOnSegment(FX_FLOAT aX, |
29 FX_FLOAT aY, | 30 FX_FLOAT aY, |
30 FX_FLOAT bX, | 31 FX_FLOAT bX, |
31 FX_FLOAT bY); | 32 FX_FLOAT bY); |
32 int32_t DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY); | 33 int32_t DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY); |
33 CFX_PtrArray* CenterEdges(CBC_ResultPoint* y, | 34 CFX_ArrayTemplate<CBC_ResultPoint*>* CenterEdges(CBC_ResultPoint* y, |
34 CBC_ResultPoint* z, | 35 CBC_ResultPoint* z, |
35 CBC_ResultPoint* x, | 36 CBC_ResultPoint* x, |
36 CBC_ResultPoint* t); | 37 CBC_ResultPoint* t) const; |
| 38 |
37 FX_BOOL ContainsBlackPoint(int32_t a, | 39 FX_BOOL ContainsBlackPoint(int32_t a, |
38 int32_t b, | 40 int32_t b, |
39 int32_t fixed, | 41 int32_t fixed, |
40 FX_BOOL horizontal); | 42 FX_BOOL horizontal); |
41 | 43 |
42 static const int32_t INIT_SIZE = 30; | 44 static const int32_t INIT_SIZE = 30; |
43 static const int32_t CORR = 1; | 45 static const int32_t CORR = 1; |
44 | 46 |
45 CBC_CommonBitMatrix* m_image; | 47 CBC_CommonBitMatrix* m_image; |
46 int32_t m_height; | 48 int32_t m_height; |
47 int32_t m_width; | 49 int32_t m_width; |
48 int32_t m_leftInit; | 50 int32_t m_leftInit; |
49 int32_t m_rightInit; | 51 int32_t m_rightInit; |
50 int32_t m_downInit; | 52 int32_t m_downInit; |
51 int32_t m_upInit; | 53 int32_t m_upInit; |
52 }; | 54 }; |
53 | 55 |
54 #endif // XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ | 56 #endif // XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ |
OLD | NEW |