Home | History | Annotate | Download | only in common
      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_WHITERECTANLEDETECTOR_H_
      8 #define _BC_WHITERECTANLEDETECTOR_H_
      9 class CBC_CommonBitMatrix;
     10 class CBC_ResultPoint;
     11 class CBC_WhiteRectangleDetector {
     12  public:
     13   CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image);
     14   CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image,
     15                              int32_t initSize,
     16                              int32_t x,
     17                              int32_t y);
     18   virtual ~CBC_WhiteRectangleDetector();
     19   CFX_PtrArray* Detect(int32_t& e);
     20   virtual void Init(int32_t& e);
     21 
     22  private:
     23   int32_t Round(float d);
     24   CBC_ResultPoint* GetBlackPointOnSegment(FX_FLOAT aX,
     25                                           FX_FLOAT aY,
     26                                           FX_FLOAT bX,
     27                                           FX_FLOAT bY);
     28   int32_t DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY);
     29   CFX_PtrArray* CenterEdges(CBC_ResultPoint* y,
     30                             CBC_ResultPoint* z,
     31                             CBC_ResultPoint* x,
     32                             CBC_ResultPoint* t);
     33   FX_BOOL ContainsBlackPoint(int32_t a,
     34                              int32_t b,
     35                              int32_t fixed,
     36                              FX_BOOL horizontal);
     37   const static int32_t INIT_SIZE;
     38   const static int32_t CORR;
     39 
     40   CBC_CommonBitMatrix* m_image;
     41   int32_t m_height;
     42   int32_t m_width;
     43   int32_t m_leftInit;
     44   int32_t m_rightInit;
     45   int32_t m_downInit;
     46   int32_t m_upInit;
     47 };
     48 #endif
     49