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 _BC_QRDETECTOR_H_ 8 #define _BC_QRDETECTOR_H_ 9 class CBC_ResultPoint; 10 class CBC_CommonBitMatrix; 11 class CBC_QRDetectorResult; 12 class CBC_QRFinderPatternInfo; 13 class CBC_QRAlignmentPattern; 14 class CBC_QRFinderPatternFinder; 15 class CBC_QRCoderVersion; 16 class CBC_QRGridSampler; 17 class CBC_QRAlignmentPatternFinder; 18 class CBC_QRAlignmentPattern; 19 class CBC_QRDetector; 20 class CBC_QRDetector { 21 private: 22 CBC_CommonBitMatrix* m_image; 23 24 public: 25 CBC_QRDetector(CBC_CommonBitMatrix* image); 26 virtual ~CBC_QRDetector(); 27 28 CBC_CommonBitMatrix* GetImage(); 29 CBC_QRDetectorResult* Detect(int32_t hints, int32_t& e); 30 CBC_QRDetectorResult* ProcessFinderPatternInfo(CBC_QRFinderPatternInfo* info, 31 int32_t& e); 32 FX_FLOAT CalculateModuleSize(CBC_ResultPoint* topLeft, 33 CBC_ResultPoint* topRight, 34 CBC_ResultPoint* bottomLeft); 35 FX_FLOAT CalculateModuleSizeOneWay(CBC_ResultPoint* pattern, 36 CBC_ResultPoint* otherPattern); 37 FX_FLOAT SizeOfBlackWhiteBlackRunBothWays(int32_t fromX, 38 int32_t fromY, 39 int32_t toX, 40 int32_t toY); 41 FX_FLOAT SizeOfBlackWhiteBlackRun(int32_t fromX, 42 int32_t fromY, 43 int32_t toX, 44 int32_t toY); 45 CBC_QRAlignmentPattern* FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, 46 int32_t estAlignmentX, 47 int32_t estAlignmentY, 48 FX_FLOAT allowanceFactor, 49 int32_t& e); 50 static int32_t Round(FX_FLOAT d); 51 static int32_t ComputeDimension(CBC_ResultPoint* topLeft, 52 CBC_ResultPoint* topRight, 53 CBC_ResultPoint* bottomLeft, 54 FX_FLOAT moduleSize, 55 int32_t& e); 56 static CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix* image, 57 CBC_ResultPoint* topLeft, 58 CBC_ResultPoint* topRight, 59 CBC_ResultPoint* bottomLeft, 60 CBC_ResultPoint* alignmentPattern, 61 int32_t dimension, 62 int32_t& e); 63 }; 64 #endif 65