xref: /aosp_15_r20/external/pdfium/xfa/fgas/graphics/cfgas_gepath.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 The PDFium Authors
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_coordinates.h"
11 #include "core/fxge/cfx_path.h"
12 
13 class CFGAS_GEPath final {
14  public:
15   CFGAS_GEPath();
16   ~CFGAS_GEPath();
17 
GetPath()18   const CFX_Path& GetPath() const { return path_; }
19 
20   void Clear();
IsEmpty()21   bool IsEmpty() const { return path_.GetPoints().empty(); }
22   void TransformBy(const CFX_Matrix& mt);
23 
24   void Close();
25   void MoveTo(const CFX_PointF& point);
26   void LineTo(const CFX_PointF& point);
27   void BezierTo(const CFX_PointF& c1,
28                 const CFX_PointF& c2,
29                 const CFX_PointF& to);
30   void ArcTo(const CFX_PointF& pos,
31              const CFX_SizeF& size,
32              float startAngle,
33              float sweepAngle);
34 
35   void AddLine(const CFX_PointF& p1, const CFX_PointF& p2);
36   void AddRectangle(float left, float top, float width, float height);
37   void AddEllipse(const CFX_RectF& rect);
38   void AddArc(const CFX_PointF& pos,
39               const CFX_SizeF& size,
40               float startAngle,
41               float sweepAngle);
42 
43   void AddSubpath(const CFGAS_GEPath& path);
44 
45  private:
46   void ArcToInternal(const CFX_PointF& pos,
47                      const CFX_SizeF& size,
48                      float start_angle,
49                      float sweep_angle);
50 
51   CFX_Path path_;
52 };
53 
54 #endif  // XFA_FGAS_GRAPHICS_CFGAS_GEPATH_H_
55