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_FGAS_GRAPHICS_CFGAS_GEPATH_H_
8 #define XFA_FGAS_GRAPHICS_CFGAS_GEPATH_H_
9 
10 #include "core/fxcrt/fx_system.h"
11 #include "core/fxge/cfx_pathdata.h"
12 #include "xfa/fgas/graphics/cfgas_gegraphics.h"
13 
14 class CFGAS_GEPath final {
15  public:
16   CFGAS_GEPath();
17   ~CFGAS_GEPath();
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              float startAngle,
34              float sweepAngle);
35 
36   void AddLine(const CFX_PointF& p1, const CFX_PointF& p2);
37   void AddRectangle(float left, float top, float width, float height);
38   void AddEllipse(const CFX_RectF& rect);
39   void AddArc(const CFX_PointF& pos,
40               const CFX_SizeF& size,
41               float startAngle,
42               float sweepAngle);
43 
44   void AddSubpath(CFGAS_GEPath* path);
45 
46  private:
47   void ArcToInternal(const CFX_PointF& pos,
48                      const CFX_SizeF& size,
49                      float start_angle,
50                      float sweep_angle);
51 
52   CFX_PathData data_;
53 };
54 
55 #endif  // XFA_FGAS_GRAPHICS_CFGAS_GEPATH_H_
56