• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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 XFA_FXGRAPHICS_CFX_PATH_H_
8 #define XFA_FXGRAPHICS_CFX_PATH_H_
9 
10 #include "core/fxcrt/fx_system.h"
11 #include "core/fxge/cfx_pathdata.h"
12 #include "xfa/fxgraphics/cfx_graphics.h"
13 
14 class CFX_Path final {
15  public:
16   CFX_Path();
17   ~CFX_Path();
18 
GetPathData()19   const CFX_PathData* GetPathData() const { return &data_; }
20 
21   void Clear();
IsEmpty()22   bool IsEmpty() const { return data_.GetPoints().empty(); }
23   void TransformBy(const CFX_Matrix& mt);
24 
25   void Close();
26   void MoveTo(const CFX_PointF& point);
27   void LineTo(const CFX_PointF& point);
28   void BezierTo(const CFX_PointF& c1,
29                 const CFX_PointF& c2,
30                 const CFX_PointF& to);
31   void ArcTo(const CFX_PointF& pos,
32              const CFX_SizeF& size,
33              FX_FLOAT startAngle,
34              FX_FLOAT sweepAngle);
35 
36   void AddLine(const CFX_PointF& p1, const CFX_PointF& p2);
37   void AddRectangle(FX_FLOAT left,
38                     FX_FLOAT top,
39                     FX_FLOAT width,
40                     FX_FLOAT height);
41   void AddEllipse(const CFX_RectF& rect);
42   void AddArc(const CFX_PointF& pos,
43               const CFX_SizeF& size,
44               FX_FLOAT startAngle,
45               FX_FLOAT sweepAngle);
46 
47   void AddSubpath(CFX_Path* path);
48 
49  private:
50   void ArcToInternal(const CFX_PointF& pos,
51                      const CFX_SizeF& size,
52                      FX_FLOAT start_angle,
53                      FX_FLOAT sweep_angle);
54 
55   CFX_PathData data_;
56 };
57 
58 #endif  // XFA_FXGRAPHICS_CFX_PATH_H_
59