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 {
33 e_PathPointTypeNormal = 0,
35 e_PathPointTypeStart = 1,
37 e_PathPointTypeMoveTo = 2,
39 e_PathPointTypeLineTo = 3,
41 e_PathPointTypeQuadraticBezierTo = 4,
43 e_PathPointTypeCubicBezierTo = 5,
45 e_PathPointTypeArcTo = 6,
47 e_PathPointTypeClose = 7
48 } PathPointType;
49
53 PathPoint()
54 : x(0)
55 , y(0)
56 , type(e_PathPointTypeNormal) {
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
118 PathPointType type;
119 };
120
122 class EllipseInfo FS_FINAL : public Object {
123 public:
133 EllipseInfo(float x_radius, float y_radius, float rotation_angle, bool large_arc, bool sweep_direction)
134 : x_radius(x_radius),
135 y_radius(y_radius),
136 rotation_angle(rotation_angle),
137 large_arc(large_arc),
138 sweep_direction(sweep_direction) {
139 }
140
148 EllipseInfo& operator=(const EllipseInfo& other) {
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
190 float rotation_angle;
191
195 bool large_arc;
196
200 bool sweep_direction;
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_
foxit::ofd::graphics::OFDPathData::operator !=
bool operator !=(const OFDPathData &other) const
不相等操作符。
foxit::ofd::graphics::PathPoint::e_PathPointTypeQuadraticBezierTo
二次贝塞尔曲线类型。
Definition: fs_ofdpathobject.h:41
foxit::ofd::graphics::EllipseInfo::operator=
EllipseInfo & operator=(const EllipseInfo &other)
赋值操作符。
Definition: fs_ofdpathobject.h:148
foxit::ofd::graphics::OFDPathData::GetPoint
PathPoint GetPoint(int index)
获取指定索引的路径数据点。
foxit::ofd::graphics::OFDPathData::AppendPath
void AppendPath(const OFDPathData &path_append)
附加path操作。
foxit::ofd::graphics::OFDPathData::ClearPath
void ClearPath()
清空path操作。
foxit::ofd::graphics::OFDPathData::GetPointCount
int GetPointCount()
获取路径数据点个数。
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
foxit::ofd::graphics::OFDGraphicsObject
Definition: fs_ofdgraphicsobject.h:177
foxit::ofd::graphics::PathPoint::PathPoint
PathPoint(float x, float y, PathPointType type)
带参数的构造函数。
Definition: fs_ofdpathobject.h:67
foxit::ofd::graphics::OFDPathData::ArcTo
void ArcTo(EllipseInfo arc_info, float x, float y)
从当前点连接一条到点的圆弧，并将当前点移动到点。
foxit::ofd::graphics::PathPoint::e_PathPointTypeClose
结束类型。
Definition: fs_ofdpathobject.h:47
foxit::ofd::graphics::PathPoint::x
float x
x轴方向上的值。
Definition: fs_ofdpathobject.h:107
foxit::ofd::graphics::EllipseInfo::EllipseInfo
EllipseInfo(float x_radius, float y_radius, float rotation_angle, bool large_arc, bool sweep_direction)
带参数的构造函数。
Definition: fs_ofdpathobject.h:133
foxit::ofd::graphics::PathPoint::PathPointType
PathPointType
OFD路径类型枚举。
Definition: fs_ofdpathobject.h:31
foxit::ofd::graphics::OFDPathData::MoveTo
void MoveTo(float x, float y)
将当前点移动到指定点位置。
foxit::ofd::graphics::OFDPathData::~OFDPathData
~OFDPathData()
析构函数。
foxit::ofd::graphics::OFDPathObject
Definition: fs_ofdpathobject.h:206
foxit::ofd::graphics::EllipseInfo::sweep_direction
bool sweep_direction
弧线方向是否为顺时针。
Definition: fs_ofdpathobject.h:200
foxit::ofd::graphics::OFDPathData
Definition: fs_ofdpathobject.h:360
foxit::ofd::graphics::PathPoint::e_PathPointTypeLineTo
直线类型。
Definition: fs_ofdpathobject.h:39
operator==
bool operator==(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否相等。
Definition: fs_basictypes.h:128
foxit::ofd::graphics::OFDPathData::operator=
OFDPathData & operator=(const OFDPathData &other)
赋值操作符。
foxit::ofd::graphics::OFDPathData::AddPoints
void AddPoints(PathPointArray &points)
添加路径点数据集合。
foxit::ofd::graphics::PathPoint::PathPoint
PathPoint()
构造函数。
Definition: fs_ofdpathobject.h:53
foxit::ofd::graphics::EllipseInfo
Definition: fs_ofdpathobject.h:122
foxit::ofd::graphics::OFDPathData::CloseFigure
void CloseFigure()
自动闭合，表示将当前点和起始点用线段直接连接。
foxit::ofd::graphics::OFDPathData::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::ofd::graphics::OFDPathData::CopyPath
void CopyPath(const OFDPathData &path)
拷贝path。
foxit::ofd::graphics::OFDPathData::StartFigure
void StartFigure(float x, float y)
定义图形起始点坐标。
foxit::ofd::graphics::PathPoint
Definition: fs_ofdpathobject.h:24
foxit::ofd::graphics::PathPoint::operator=
PathPoint & operator=(const PathPoint &other)
赋值操作符。
Definition: fs_ofdpathobject.h:80
foxit::ofd::graphics::PathPoint::e_PathPointTypeArcTo
弧线类型。
Definition: fs_ofdpathobject.h:45
foxit::ofd::graphics::OFDPathData::LineTo
void LineTo(float x, float y)
从当前点连接一条到指定点的线段，并将当前点移动到指定点。
foxit::ofd::graphics::PathPoint::e_PathPointTypeCubicBezierTo
三次贝塞尔曲线类型。
Definition: fs_ofdpathobject.h:43
foxit::ofd::graphics::EllipseInfo::large_arc
bool large_arc
是否是大圆弧。
Definition: fs_ofdpathobject.h:195
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
fs_common.h
通用定义和类的头文件。
foxit::ofd::graphics::OFDPathData::QuadraticBezierTo
void QuadraticBezierTo(float x1, float y1, float x2, float y2)
从当前点链接一条到点pt2的二次贝塞尔曲线，并将当前点移动到点pt2，此贝塞尔曲线使用点pt1作为其控制点。
foxit::Base
Definition: fs_basictypes.h:465
foxit::ofd::graphics::PathPoint::Set
void Set(float x, float y, PathPointType type)
设置值。
Definition: fs_ofdpathobject.h:98
foxit::ofd::graphics::PathPoint::e_PathPointTypeMoveTo
移动类型。
Definition: fs_ofdpathobject.h:37
foxit::ofd::graphics::EllipseInfo::rotation_angle
float rotation_angle
旋转角度。
Definition: fs_ofdpathobject.h:190
foxit::ofd::graphics::PathPoint::type
PathPointType type
路径类型。请参考从 foxit::ofd::graphics::PathPoint::e_PathPointTypeNormal 开始的值， 应该是这些值中的一个。
Definition: fs_ofdpathobject.h:118
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
foxit::ofd::graphics::PathPoint::y
float y
y轴方向上的值。
Definition: fs_ofdpathobject.h:112
foxit::ofd::graphics::OFDPathData::OFDPathData
OFDPathData()
不带参数函数。
CFX_ByteString
字节字符串类
Definition: fx_string.h:317
foxit::ofd::graphics::EllipseInfo::y_radius
float y_radius
y轴方向上半径。
Definition: fs_ofdpathobject.h:185
foxit::ofd::graphics::PathPoint::e_PathPointTypeStart
起始类型。
Definition: fs_ofdpathobject.h:35
foxit::ofd::graphics::EllipseInfo::x_radius
float x_radius
x轴方向上半径。
Definition: fs_ofdpathobject.h:180
foxit::ofd::graphics::EllipseInfo::Set
void Set(float x_radius, float y_radius, float rotation_angle, bool large_arc, bool sweep_direction)
设置值。
Definition: fs_ofdpathobject.h:169
foxit::ofd::graphics::OFDPathData::CubicBezierTo
void CubicBezierTo(float x1, float y1, float x2, float y2, float x3, float y3)
从当前点连接一条到点pt3的三次贝塞尔曲线，并将当前点移动到点pt3，此贝塞尔曲线使用点pt1和点pt2作为其控制点。
foxit::ofd::graphics::OFDPathData::operator==
bool operator==(const OFDPathData &other) const
相等操作符。
foxit::ofd::graphics::PathPoint::e_PathPointTypeNormal
正常类型。
Definition: fs_ofdpathobject.h:33