blob: b0a229f172ebee835b215f19b239c81f7e851bb2 [file] [log] [blame]
dsinclairacd0d592016-04-21 11:06:27 -07001// 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 XFA_FDE_CFDE_PATH_H_
8#define XFA_FDE_CFDE_PATH_H_
9
tsepez6db6fbc2017-01-20 12:22:16 -080010#include <vector>
11
dsinclair74a34fc2016-09-29 16:41:42 -070012#include "core/fxge/cfx_pathdata.h"
13#include "core/fxge/cfx_renderdevice.h"
dsinclairacd0d592016-04-21 11:06:27 -070014
Dan Sinclair0cb9b8c2017-01-10 16:38:10 -050015class CFDE_Path {
dsinclairacd0d592016-04-21 11:06:27 -070016 public:
Dan Sinclaire4602322017-02-15 11:07:32 -050017 void CloseFigure();
dsinclairacd0d592016-04-21 11:06:27 -070018
tsepez6db6fbc2017-01-20 12:22:16 -080019 void AddBezier(const std::vector<CFX_PointF>& points);
20 void AddBeziers(const std::vector<CFX_PointF>& points);
21 void AddCurve(const std::vector<CFX_PointF>& points,
tsepezd19e9122016-11-02 15:43:18 -070022 bool bClosed,
Dan Sinclair05df0752017-03-14 14:43:42 -040023 float fTension = 0.5f);
dsinclairacd0d592016-04-21 11:06:27 -070024 void AddEllipse(const CFX_RectF& rect);
tsepez6db6fbc2017-01-20 12:22:16 -080025 void AddLines(const std::vector<CFX_PointF>& points);
dsinclairacd0d592016-04-21 11:06:27 -070026 void AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2);
tsepezd19e9122016-11-02 15:43:18 -070027 void AddPath(const CFDE_Path* pSrc, bool bConnect);
tsepez6db6fbc2017-01-20 12:22:16 -080028 void AddPolygon(const std::vector<CFX_PointF>& points);
dsinclairacd0d592016-04-21 11:06:27 -070029 void AddRectangle(const CFX_RectF& rect);
Dan Sinclair1b08df12017-02-09 09:17:20 -050030
31 CFX_RectF GetBBox() const;
Dan Sinclair05df0752017-03-14 14:43:42 -040032 CFX_RectF GetBBox(float fLineWidth, float fMiterLimit) const;
Dan Sinclair1b08df12017-02-09 09:17:20 -050033
tsepezd19e9122016-11-02 15:43:18 -070034 bool FigureClosed() const;
dsinclairacd0d592016-04-21 11:06:27 -070035 void BezierTo(const CFX_PointF& p1,
36 const CFX_PointF& p2,
37 const CFX_PointF& p3);
tsepezd19e9122016-11-02 15:43:18 -070038 void ArcTo(bool bStart,
dsinclairacd0d592016-04-21 11:06:27 -070039 const CFX_RectF& rect,
Dan Sinclair05df0752017-03-14 14:43:42 -040040 float startAngle,
41 float endAngle);
dan sinclairb147e072017-02-22 19:56:15 -050042 void MoveTo(const CFX_PointF& p);
43 void LineTo(const CFX_PointF& p);
Dan Sinclair1b08df12017-02-09 09:17:20 -050044
tsepez6db6fbc2017-01-20 12:22:16 -080045 void GetCurveTangents(const std::vector<CFX_PointF>& points,
46 std::vector<CFX_PointF>* tangents,
tsepezd19e9122016-11-02 15:43:18 -070047 bool bClosed,
Dan Sinclair05df0752017-03-14 14:43:42 -040048 float fTension) const;
dsinclairacd0d592016-04-21 11:06:27 -070049 CFX_PathData m_Path;
50};
51
52#endif // XFA_FDE_CFDE_PATH_H_