summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h
blob: 8a5fd26f2281abccd2e3631b9a5d7771d95bf2e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_
#define XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_

#include "core/fxcrt/include/fx_basic.h"

class CBC_CommonPerspectiveTransform {
 public:
  CBC_CommonPerspectiveTransform(FX_FLOAT a11,
                                 FX_FLOAT a21,
                                 FX_FLOAT a31,
                                 FX_FLOAT a12,
                                 FX_FLOAT a22,
                                 FX_FLOAT a32,
                                 FX_FLOAT a13,
                                 FX_FLOAT a23,
                                 FX_FLOAT a33);
  virtual ~CBC_CommonPerspectiveTransform();

  static CBC_CommonPerspectiveTransform* QuadrilateralToQuadrilateral(
      FX_FLOAT x0,
      FX_FLOAT y0,
      FX_FLOAT x1,
      FX_FLOAT y1,
      FX_FLOAT x2,
      FX_FLOAT y2,
      FX_FLOAT x3,
      FX_FLOAT y3,
      FX_FLOAT x0p,
      FX_FLOAT y0p,
      FX_FLOAT x1p,
      FX_FLOAT y1p,
      FX_FLOAT x2p,
      FX_FLOAT y2p,
      FX_FLOAT x3p,
      FX_FLOAT y3p);
  static CBC_CommonPerspectiveTransform* SquareToQuadrilateral(FX_FLOAT x0,
                                                               FX_FLOAT y0,
                                                               FX_FLOAT x1,
                                                               FX_FLOAT y1,
                                                               FX_FLOAT x2,
                                                               FX_FLOAT y2,
                                                               FX_FLOAT x3,
                                                               FX_FLOAT y3);
  static CBC_CommonPerspectiveTransform* QuadrilateralToSquare(FX_FLOAT x0,
                                                               FX_FLOAT y0,
                                                               FX_FLOAT x1,
                                                               FX_FLOAT y1,
                                                               FX_FLOAT x2,
                                                               FX_FLOAT y2,
                                                               FX_FLOAT x3,
                                                               FX_FLOAT y3);
  CBC_CommonPerspectiveTransform* BuildAdjoint();
  CBC_CommonPerspectiveTransform* Times(CBC_CommonPerspectiveTransform& other);
  void TransformPoints(CFX_FloatArray* points);

 private:
  FX_FLOAT m_a11, m_a12, m_a13, m_a21, m_a22, m_a23, m_a31, m_a32, m_a33;
};

#endif  // XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_