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_BOUNDINGBOX_H_
8 #define _BC_BOUNDINGBOX_H_
9 class CBC_CommonBitMatrix;
10 class CBC_ResultPoint;
11 class CBC_BoundingBox {
12  public:
13   CBC_BoundingBox(CBC_CommonBitMatrix* image,
14                   CBC_ResultPoint* topLeft,
15                   CBC_ResultPoint* bottomLeft,
16                   CBC_ResultPoint* topRight,
17                   CBC_ResultPoint* bottomRight,
18                   int32_t& e);
19   CBC_BoundingBox(CBC_BoundingBox* boundingBox);
20   virtual ~CBC_BoundingBox();
21   static CBC_BoundingBox* merge(CBC_BoundingBox* leftBox,
22                                 CBC_BoundingBox* rightBox,
23                                 int32_t& e);
24   CBC_BoundingBox* addMissingRows(int32_t missingStartRows,
25                                   int32_t missingEndRows,
26                                   FX_BOOL isLeft,
27                                   int32_t& e);
28   void setTopRight(CBC_ResultPoint topRight);
29   void setBottomRight(CBC_ResultPoint bottomRight);
30   int32_t getMinX();
31   int32_t getMaxX();
32   int32_t getMinY();
33   int32_t getMaxY();
34   CBC_ResultPoint* getTopLeft();
35   CBC_ResultPoint* getTopRight();
36   CBC_ResultPoint* getBottomLeft();
37   CBC_ResultPoint* getBottomRight();
38 
39  private:
40   CBC_CommonBitMatrix* m_image;
41   CBC_ResultPoint* m_topLeft;
42   CBC_ResultPoint* m_bottomLeft;
43   CBC_ResultPoint* m_topRight;
44   CBC_ResultPoint* m_bottomRight;
45   int32_t m_minX;
46   int32_t m_maxX;
47   int32_t m_minY;
48   int32_t m_maxY;
49   void init(CBC_CommonBitMatrix* image,
50             CBC_ResultPoint* topLeft,
51             CBC_ResultPoint* bottomLeft,
52             CBC_ResultPoint* topRight,
53             CBC_ResultPoint* bottomRight);
54   void calculateMinMaxValues();
55 };
56 #endif
57