Foxit PDF SDK
fs_ofdpathobject.h
1 #ifndef FS_OFD_PATHOBJECT_H_
2 #define FS_OFD_PATHOBJECT_H_
3 
4 #include "common/fs_common.h"
5 #include "fs_ofdgraphicsobject.h"
6 
12 namespace foxit {
16 namespace ofd {
20 namespace graphics {
21 class OFDPathData;
22 
24 class PathPoint FS_FINAL : public Object {
25  public:
31  typedef enum _PathPointType {
48  } PathPointType;
49 
54  : x(0)
55  , y(0)
57  }
58 
67  PathPoint(float x, float y, PathPointType type) :
68  x(x),
69  y(x),
70  type(type) {
71  }
72 
80  PathPoint& operator=(const PathPoint& other) {
81  this->x = other.x;
82  this->y = other.y;
83  this->type = other.type;
84 
85  return *this;
86  }
87 
98  void Set(float x, float y, PathPointType type) {
99  this->x = x;
100  this->y = y;
101  this->type = type;
102  }
103 
107  float x;
108 
112  float y;
113 
119 };
120 
122 class EllipseInfo FS_FINAL : public Object {
123  public:
134  : x_radius(x_radius),
139  }
140 
149  this->x_radius = other.x_radius;
150  this->y_radius = other.y_radius;
151  this->rotation_angle = other.rotation_angle;
152  this->large_arc = other.large_arc;
153  this->sweep_direction = other.sweep_direction;
154 
155  return *this;
156  }
157 
169  void Set(float x_radius, float y_radius, float rotation_angle, bool large_arc, bool sweep_direction) {
170  this->x_radius = x_radius;
171  this->y_radius = y_radius;
172  this->rotation_angle = rotation_angle;
173  this->large_arc = large_arc;
174  this->sweep_direction = sweep_direction;
175  }
176 
180  float x_radius;
181 
185  float y_radius;
186 
191 
195  bool large_arc;
196 
201 };
202 
203 FSDK_DEFINE_ARRAY(PathPointArray, PathPoint)
204 
205 
206 class OFDPathObject FS_FINAL : public OFDGraphicsObject {
207  public:
213  typedef enum _PathFillMode {
215  e_PathFillNonZero = 0,
217  e_PathFillEvenOdd = 1
218  } PathFillMode;
219 
220 
226  explicit OFDPathObject(OFDGraphicsObject object);
227 
229  ~OFDPathObject();
230 
236  OFDPathObject(const OFDPathObject& other);
237 
245  OFDPathObject& operator = (const OFDPathObject& other);
246 
254  bool operator == (const OFDPathObject& other) const;
255 
263  bool operator != (const OFDPathObject& other) const;
264 
272  bool IsEmpty() const;
273 
279  bool IsFill();
280 
286  bool IsStroke();
287 
293  OFDPathData GetPathData();
294 
300  String GetAbbreviatedData();
301 
308  PathFillMode GetFillMode();
309 
317  void SetFill(bool fill);
318 
327  void SetFillMode(PathFillMode fill_mode = e_PathFillNonZero);
328 
336  void SetStroke(bool stroke);
337 
345  void SetAbbreviatedData(const String& abbreviated_data);
346 
354  void SetPathData(const OFDPathData& path);
355 
356  explicit OFDPathObject(FS_HANDLE handle);
357 };
358 
360 class OFDPathData FS_FINAL : public Base {
361  public:
363  OFDPathData();
364 
366  ~OFDPathData();
367 
373  OFDPathData(const OFDPathData& other);
374 
382  OFDPathData& operator = (const OFDPathData& other);
383 
391  bool operator == (const OFDPathData& other) const;
392 
400  bool operator != (const OFDPathData& other) const;
401 
409  bool IsEmpty() const;
410 
419  void StartFigure(float x, float y);
420 
429  void MoveTo(float x, float y);
430 
439  void LineTo(float x, float y);
440 
451  void QuadraticBezierTo(float x1, float y1, float x2, float y2);
452 
465  void CubicBezierTo(float x1, float y1, float x2, float y2, float x3, float y3);
466 
476  void ArcTo(EllipseInfo arc_info, float x, float y);
477 
485  void AddPoints(PathPointArray& points);
486 
492  void CloseFigure();
493 
499  void ClearPath();
500 
508  void AppendPath(const OFDPathData& path_append);
509 
517  void CopyPath(const OFDPathData& path);
518 
524  int GetPointCount();
525 
534  PathPoint GetPoint(int index);
535 
536  explicit OFDPathData(FS_HANDLE handle);
537 };
538 
539 } // namespace graphics
540 } // namespace ofd
541 } // namespace foxit
542 
543 #endif // FS_OFD_PATHOBJECT_H_
bool operator !=(const OFDPathData &other) const
不相等操作符。
二次贝塞尔曲线类型。
Definition: fs_ofdpathobject.h:41
EllipseInfo & operator=(const EllipseInfo &other)
赋值操作符。
Definition: fs_ofdpathobject.h:148
PathPoint GetPoint(int index)
获取指定索引的路径数据点。
void AppendPath(const OFDPathData &path_append)
附加path操作。
void ClearPath()
清空path操作。
int GetPointCount()
获取路径数据点个数。
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
Definition: fs_ofdgraphicsobject.h:177
PathPoint(float x, float y, PathPointType type)
带参数的构造函数。
Definition: fs_ofdpathobject.h:67
void ArcTo(EllipseInfo arc_info, float x, float y)
从当前点连接一条到点的圆弧,并将当前点移动到点。
结束类型。
Definition: fs_ofdpathobject.h:47
float x
x轴方向上的值。
Definition: fs_ofdpathobject.h:107
EllipseInfo(float x_radius, float y_radius, float rotation_angle, bool large_arc, bool sweep_direction)
带参数的构造函数。
Definition: fs_ofdpathobject.h:133
PathPointType
OFD路径类型枚举。
Definition: fs_ofdpathobject.h:31
void MoveTo(float x, float y)
将当前点移动到指定点位置。
Definition: fs_ofdpathobject.h:206
bool sweep_direction
弧线方向是否为顺时针。
Definition: fs_ofdpathobject.h:200
Definition: fs_ofdpathobject.h:360
直线类型。
Definition: fs_ofdpathobject.h:39
bool operator==(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否相等。
Definition: fs_basictypes.h:128
OFDPathData & operator=(const OFDPathData &other)
赋值操作符。
void AddPoints(PathPointArray &points)
添加路径点数据集合。
PathPoint()
构造函数。
Definition: fs_ofdpathobject.h:53
Definition: fs_ofdpathobject.h:122
void CloseFigure()
自动闭合,表示将当前点和起始点用线段直接连接。
bool IsEmpty() const
检查当前对象是否为空。
void CopyPath(const OFDPathData &path)
拷贝path。
void StartFigure(float x, float y)
定义图形起始点坐标。
Definition: fs_ofdpathobject.h:24
PathPoint & operator=(const PathPoint &other)
赋值操作符。
Definition: fs_ofdpathobject.h:80
弧线类型。
Definition: fs_ofdpathobject.h:45
void LineTo(float x, float y)
从当前点连接一条到指定点的线段,并将当前点移动到指定点。
三次贝塞尔曲线类型。
Definition: fs_ofdpathobject.h:43
bool large_arc
是否是大圆弧。
Definition: fs_ofdpathobject.h:195
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
通用定义和类的头文件。
void QuadraticBezierTo(float x1, float y1, float x2, float y2)
从当前点链接一条到点pt2的二次贝塞尔曲线,并将当前点移动到点pt2,此贝塞尔曲线使用点pt1作为其控制点。
Definition: fs_basictypes.h:465
void Set(float x, float y, PathPointType type)
设置值。
Definition: fs_ofdpathobject.h:98
移动类型。
Definition: fs_ofdpathobject.h:37
float rotation_angle
旋转角度。
Definition: fs_ofdpathobject.h:190
PathPointType type
路径类型。请参考从 foxit::ofd::graphics::PathPoint::e_PathPointTypeNormal 开始的值, 应该是这些值中的一个。
Definition: fs_ofdpathobject.h:118
Foxit命名空间。
Definition: fs_taggedpdf.h:27
float y
y轴方向上的值。
Definition: fs_ofdpathobject.h:112
OFDPathData()
不带参数函数。
字节字符串类
Definition: fx_string.h:317
float y_radius
y轴方向上半径。
Definition: fs_ofdpathobject.h:185
起始类型。
Definition: fs_ofdpathobject.h:35
float x_radius
x轴方向上半径。
Definition: fs_ofdpathobject.h:180
void Set(float x_radius, float y_radius, float rotation_angle, bool large_arc, bool sweep_direction)
设置值。
Definition: fs_ofdpathobject.h:169
void CubicBezierTo(float x1, float y1, float x2, float y2, float x3, float y3)
从当前点连接一条到点pt3的三次贝塞尔曲线,并将当前点移动到点pt3,此贝塞尔曲线使用点pt1和点pt2作为其控制点。
bool operator==(const OFDPathData &other) const
相等操作符。
正常类型。
Definition: fs_ofdpathobject.h:33