dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 1 | // 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 | |
tsepez | 6db6fbc | 2017-01-20 12:22:16 -0800 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
dsinclair | 74a34fc | 2016-09-29 16:41:42 -0700 | [diff] [blame] | 12 | #include "core/fxge/cfx_pathdata.h" |
| 13 | #include "core/fxge/cfx_renderdevice.h" |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 14 | |
Dan Sinclair | 0cb9b8c | 2017-01-10 16:38:10 -0500 | [diff] [blame] | 15 | class CFDE_Path { |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 16 | public: |
Dan Sinclair | e460232 | 2017-02-15 11:07:32 -0500 | [diff] [blame] | 17 | void CloseFigure(); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 18 | |
tsepez | 6db6fbc | 2017-01-20 12:22:16 -0800 | [diff] [blame] | 19 | 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, |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 22 | bool bClosed, |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 23 | float fTension = 0.5f); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 24 | void AddEllipse(const CFX_RectF& rect); |
tsepez | 6db6fbc | 2017-01-20 12:22:16 -0800 | [diff] [blame] | 25 | void AddLines(const std::vector<CFX_PointF>& points); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 26 | void AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2); |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 27 | void AddPath(const CFDE_Path* pSrc, bool bConnect); |
tsepez | 6db6fbc | 2017-01-20 12:22:16 -0800 | [diff] [blame] | 28 | void AddPolygon(const std::vector<CFX_PointF>& points); |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 29 | void AddRectangle(const CFX_RectF& rect); |
Dan Sinclair | 1b08df1 | 2017-02-09 09:17:20 -0500 | [diff] [blame] | 30 | |
| 31 | CFX_RectF GetBBox() const; |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 32 | CFX_RectF GetBBox(float fLineWidth, float fMiterLimit) const; |
Dan Sinclair | 1b08df1 | 2017-02-09 09:17:20 -0500 | [diff] [blame] | 33 | |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 34 | bool FigureClosed() const; |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 35 | void BezierTo(const CFX_PointF& p1, |
| 36 | const CFX_PointF& p2, |
| 37 | const CFX_PointF& p3); |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 38 | void ArcTo(bool bStart, |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 39 | const CFX_RectF& rect, |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 40 | float startAngle, |
| 41 | float endAngle); |
dan sinclair | b147e07 | 2017-02-22 19:56:15 -0500 | [diff] [blame] | 42 | void MoveTo(const CFX_PointF& p); |
| 43 | void LineTo(const CFX_PointF& p); |
Dan Sinclair | 1b08df1 | 2017-02-09 09:17:20 -0500 | [diff] [blame] | 44 | |
tsepez | 6db6fbc | 2017-01-20 12:22:16 -0800 | [diff] [blame] | 45 | void GetCurveTangents(const std::vector<CFX_PointF>& points, |
| 46 | std::vector<CFX_PointF>* tangents, |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 47 | bool bClosed, |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 48 | float fTension) const; |
dsinclair | acd0d59 | 2016-04-21 11:06:27 -0700 | [diff] [blame] | 49 | CFX_PathData m_Path; |
| 50 | }; |
| 51 | |
| 52 | #endif // XFA_FDE_CFDE_PATH_H_ |