Foxit PDF SDK

fs_ofdgraphicsobject.h
1 #ifndef FS_OFD_GRAPHICS_OBJECT_H_
2 #define FS_OFD_GRAPHICS_OBJECT_H_
3
4 #include "common/fs_common.h"
5 #include "common/fs_image.h"
6
12 namespace foxit {
16 namespace common {
17 class Image;
18 };
19 namespace ofd {
20 class Actions;
24 namespace graphics {
26 class BorderInfo FS_FINAL : public Object {
27 public:
33 typedef enum _LineCapMode {
37 e_LineCapButt = 0,
41 e_LineCapRound = 1,
45 e_LineCapSquare = 2
46 } LineCapMode;
47
48
52 BorderInfo()
53 :line_width(0.0f)
54 ,line_cap(e_LineCapButt)
55 ,color(0)
56 ,h_radius(0.0f)
57 ,v_radius(0.0f)
58 ,dash_offset(0.0f) {}
59
72 explicit BorderInfo(float line_width, LineCapMode line_cap, foxit::RGB color, float h_radius, float v_radius, float dash_offset, foxit::FloatArray dash_pattern) :
73 line_width(line_width),
74 line_cap(line_cap),
75 color(color),
76 h_radius(h_radius),
77 v_radius(v_radius),
78 dash_offset(dash_offset) {
79 this->dash_pattern.Copy(dash_pattern);
80 }
81
87 BorderInfo(const BorderInfo& other) {
88 this->line_width = other.line_width;
89 this->line_cap = other.line_cap;
90 this->color = other.color;
91 this->h_radius = other.h_radius;
92 this->v_radius = other.v_radius;
93 this->dash_offset = other.dash_offset;
94 this->dash_pattern.Copy(other.dash_pattern);
95 }
96
104 BorderInfo& operator = (const BorderInfo& other) {
105 this->line_width = other.line_width;
106 this->line_cap = other.line_cap;
107 this->color = other.color;
108 this->h_radius = other.h_radius;
109 this->v_radius = other.v_radius;
110 this->dash_offset = other.dash_offset;
111 this->dash_pattern.Copy(other.dash_pattern);
112 return *this;
113 }
114
129 void Set(float line_width, LineCapMode line_cap, foxit::RGB color, float h_radius, float v_radius, float dash_offset, foxit::FloatArray dash_pattern) {
130 this->line_width = line_width;
131 this->line_cap = line_cap;
132 this->color = color;
133 this->h_radius = h_radius;
134 this->v_radius = v_radius;
135 this->dash_offset = dash_offset;
136 this->dash_pattern.Copy(dash_pattern);
137 }
138
142 float line_width;
143
148 LineCapMode line_cap;
149
153 foxit::RGB color;
154
158 float h_radius;
159
163 float v_radius;
164
168 float dash_offset;
169
173 foxit::FloatArray dash_pattern;
174 };
175
177 class OFDGraphicsObject : public Base {
178 public:
184 typedef enum _ObjectType {
186 e_ObjectTypeUnknown = 0,
188 e_ObjectTypePageBlock = 2,
190 e_ObjectTypeComposite = 3,
192 e_ObjectTypeSVG = 4,
194 e_ObjectTypeText = 5,
196 e_ObjectTypePath = 6,
198 e_ObjectTypeImage = 7,
200 e_ObjectTypeVideo = 8
201 } ObjectType;
202
208 typedef enum _LineCapMode {
212 e_LineCapButt = 0,
216 e_LineCapRound = 1,
220 e_LineCapSquare = 2
221 } LineCapMode;
222
228 typedef enum _LineJoinMode {
234 e_LineJoinMiter = 0,
241 e_LineJoinRound = 1,
248 e_LineJoinBevel = 2
249 } LineJoinMode;
250
251
253 ~OFDGraphicsObject();
254
260 OFDGraphicsObject(const OFDGraphicsObject& other);
261
269 OFDGraphicsObject& operator = (const OFDGraphicsObject& other);
270
278 bool operator == (const OFDGraphicsObject& other) const;
279
287 bool operator != (const OFDGraphicsObject& other) const;
288
296 bool IsEmpty() const;
297
303 foxit::uint32 GetID();
304
311 ObjectType GetType();
312
318 int GetPageIndex();
319
325 String GetName();
326
332 bool IsVisible();
333
339 bool HasBorder();
340
346 BorderInfo GetBorderInfo();
347
353 foxit::RectF GetBoundary();
354
360 foxit::Matrix GetMatrix();
361
367 foxit::uint8 GetAlpha();
368
374 foxit::RGB GetFillColor();
375
381 foxit::RGB GetStrokeColor();
382
388 float GetLineWidth();
389
396 LineCapMode GetLineCap();
397
404 LineJoinMode GetLineJoin();
405
411 float GetMiterLimit();
412
418 float GetDashOffset();
419
425 foxit::FloatArray GetDashPattern();
426
434 void SetName(const String& name);
442 void SetVisible(bool visible);
443
451 void SetBorderInfo(const BorderInfo& border_info);
452
460 void SetBoundary(const RectF& boundary);
461
469 void SetMatrix(const Matrix& mt);
470
478 void SetAlpha(foxit::uint8 alpha);
479
487 void SetFillColor(foxit::uint32 fill_color);
488
496 void SetStrokeColor(foxit::uint32 stroke_color);
497
505 void SetLineWidth(float line_width);
506
515 void SetLineCap(LineCapMode line_cap = e_LineCapButt);
516
525 void SetLineJoin(LineJoinMode line_join = e_LineJoinMiter);
526
534 void SetMiterLimit(float miter_limit);
535
543 void SetDashOffset(float dash_offset);
544
553 void SetDashPattern(float dash_offset, const foxit::FloatArray& dash_offset_array);
554
560 Actions CreateActions();
561
567 Actions GetActions();
568
569 explicit OFDGraphicsObject(FS_HANDLE handle);
570 };
571
572 } // namespace graphics
573 } // namespace ofd
574 } // namespace foxit
575
576 #endif // FS_OFD_OBJECT_H_
foxit::ofd::graphics::BorderInfo::e_LineCapSquare
投影方形端盖。描边在路径端点之外继续延伸等于线宽一半的距离，并被切断。
Definition: fs_ofdgraphicsobject.h:45
foxit::ofd::graphics::OFDGraphicsObject::SetLineCap
void SetLineCap(LineCapMode line_cap=e_LineCapButt)
设置图元对象线帽样式。
foxit::ofd::graphics::BorderInfo::operator=
BorderInfo & operator=(const BorderInfo &other)
赋值操作符。
Definition: fs_ofdgraphicsobject.h:104
foxit::ofd::graphics::OFDGraphicsObject::GetMatrix
foxit::Matrix GetMatrix()
获取图元对象矩阵。
foxit::ofd::graphics::OFDGraphicsObject::SetStrokeColor
void SetStrokeColor(foxit::uint32 stroke_color)
设置图元对象勾边颜色。
foxit::ofd::graphics::OFDGraphicsObject::SetVisible
void SetVisible(bool visible)
设置图元对象可见性属性。
foxit::ofd::graphics::BorderInfo::h_radius
float h_radius
横向圆角半径。
Definition: fs_ofdgraphicsobject.h:158
foxit::ofd::graphics::BorderInfo::Set
void Set(float line_width, LineCapMode line_cap, foxit::RGB color, float h_radius, float v_radius, float dash_offset, foxit::FloatArray dash_pattern)
设置值。
Definition: fs_ofdgraphicsobject.h:129
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
foxit::ofd::graphics::OFDGraphicsObject
Definition: fs_ofdgraphicsobject.h:177
foxit::ofd::graphics::OFDGraphicsObject::SetDashPattern
void SetDashPattern(float dash_offset, const foxit::FloatArray &dash_offset_array)
设置图元对象虚线重复样式。
foxit::ofd::graphics::OFDGraphicsObject::GetAlpha
foxit::uint8 GetAlpha()
获取图元对象alpha属性。
foxit::ofd::graphics::OFDGraphicsObject::GetName
String GetName()
获取图元对象名称。
foxit::ofd::graphics::OFDGraphicsObject::ObjectType
ObjectType
OFD图元对象类型定义枚举类型.
Definition: fs_ofdgraphicsobject.h:184
foxit::uint8
FX_UINT8 uint8
无符号 8 位整数。
Definition: fs_basictypes.h:203
foxit::RGB
uint32 RGB
RGB 颜色类型，24 位，((b) | ((g) << 8) | ((r) << 16)))
Definition: fs_basictypes.h:211
foxit::ofd::graphics::OFDGraphicsObject::e_ObjectTypeSVG
对象类型：矢量图形。
Definition: fs_ofdgraphicsobject.h:192
foxit::ofd::graphics::OFDGraphicsObject::IsVisible
bool IsVisible()
获取图元对象可见性属性。
foxit::ofd::graphics::OFDGraphicsObject::SetFillColor
void SetFillColor(foxit::uint32 fill_color)
设置图元对象填充颜色。
foxit::ofd::graphics::OFDGraphicsObject::operator==
bool operator==(const OFDGraphicsObject &other) const
相等操作符。
foxit::ofd::graphics::OFDGraphicsObject::e_ObjectTypeUnknown
对象类型：未知
Definition: fs_ofdgraphicsobject.h:186
foxit::ofd::graphics::OFDGraphicsObject::GetBoundary
foxit::RectF GetBoundary()
获取图元对象矩形外接框。
foxit::ofd::graphics::BorderInfo::BorderInfo
BorderInfo(const BorderInfo &other)
构造函数，通过另一个边框信息对象。
Definition: fs_ofdgraphicsobject.h:87
foxit::ofd::graphics::OFDGraphicsObject::~OFDGraphicsObject
~OFDGraphicsObject()
析构函数。
foxit::ofd::graphics::OFDGraphicsObject::GetBorderInfo
BorderInfo GetBorderInfo()
获取图元对象边框信息(只有Image和Video对象可能会存在边框)。
foxit::ofd::graphics::OFDGraphicsObject::e_LineCapButt
平头端盖。描边在路径的端点处被切断。路径末端之外没有投影。
Definition: fs_ofdgraphicsobject.h:212
CFX_ArrayTemplate::Copy
FX_BOOL Copy(const CFX_ArrayTemplate &src)
从数组复制。
Definition: fx_basic.h:1479
foxit::ofd::graphics::OFDGraphicsObject::GetDashPattern
foxit::FloatArray GetDashPattern()
获取图元对象虚线重复样式数组。
fs_image.h
图像和位图相关定义和类的头文件。
foxit::ofd::graphics::OFDGraphicsObject::GetFillColor
foxit::RGB GetFillColor()
获取图元对象填充颜色。
foxit::ofd::graphics::OFDGraphicsObject::SetDashOffset
void SetDashOffset(float dash_offset)
设置图元对象虚线重复样式起始值。
foxit::ofd::graphics::OFDGraphicsObject::operator !=
bool operator !=(const OFDGraphicsObject &other) const
不相等操作符。
foxit::ofd::graphics::OFDGraphicsObject::GetMiterLimit
float GetMiterLimit()
获取图元对象斜切限制值。
foxit::ofd::graphics::BorderInfo::BorderInfo
BorderInfo(float line_width, LineCapMode line_cap, foxit::RGB color, float h_radius, float v_radius, float dash_offset, foxit::FloatArray dash_pattern)
带参数的构造函数。
Definition: fs_ofdgraphicsobject.h:72
foxit::ofd::graphics::BorderInfo::line_cap
LineCapMode line_cap
线端点样式。请参考从 foxit::ofd::graphics::BorderInfo::e_LineCapButt 开始的值， 应该是这些值中的一个。
Definition: fs_ofdgraphicsobject.h:148
foxit::ofd::graphics::OFDGraphicsObject::e_LineJoinMiter
斜接线条连接类型。
Definition: fs_ofdgraphicsobject.h:234
foxit::ofd::graphics::OFDGraphicsObject::e_ObjectTypePath
对象类型：路径。
Definition: fs_ofdgraphicsobject.h:196
foxit::ofd::graphics::OFDGraphicsObject::GetID
foxit::uint32 GetID()
获取图元对象资源ID。
foxit::ofd::graphics::OFDGraphicsObject::GetActions
Actions GetActions()
获取图元对象的动作集合。
foxit::ofd::graphics::BorderInfo::BorderInfo
BorderInfo()
构造函数。
Definition: fs_ofdgraphicsobject.h:52
foxit::ofd::graphics::OFDGraphicsObject::GetDashOffset
float GetDashOffset()
获取图元对象虚线重复样式。
foxit::ofd::graphics::OFDGraphicsObject::GetPageIndex
int GetPageIndex()
获取图元对象所在页面的索引号。
foxit::ofd::graphics::OFDGraphicsObject::e_ObjectTypeVideo
对象类型：视频。
Definition: fs_ofdgraphicsobject.h:200
foxit::ofd::graphics::OFDGraphicsObject::GetStrokeColor
foxit::RGB GetStrokeColor()
获取图元对象勾边颜色。
foxit::ofd::Actions
Definition: fs_ofdaction.h:679
foxit::ofd::graphics::OFDGraphicsObject::SetLineJoin
void SetLineJoin(LineJoinMode line_join=e_LineJoinMiter)
设置线条连接样式。
foxit::ofd::graphics::OFDGraphicsObject::GetLineCap
LineCapMode GetLineCap()
获取图元对象线帽样式。
CFX_ArrayTemplate< float >
foxit::ofd::graphics::OFDGraphicsObject::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::ofd::graphics::OFDGraphicsObject::SetBorderInfo
void SetBorderInfo(const BorderInfo &border_info)
设置图元对象边框信息。
foxit::ofd::graphics::OFDGraphicsObject::e_LineJoinRound
圆角线条连接类型。
Definition: fs_ofdgraphicsobject.h:241
foxit::uint32
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:195
foxit::ofd::graphics::OFDGraphicsObject::e_ObjectTypeText
对象类型：文字。
Definition: fs_ofdgraphicsobject.h:194
foxit::ofd::graphics::OFDGraphicsObject::SetAlpha
void SetAlpha(foxit::uint8 alpha)
设置图元对象alpha属性。
foxit::ofd::graphics::OFDGraphicsObject::SetName
void SetName(const String &name)
设置图元对象名称。
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
foxit::ofd::graphics::BorderInfo
Definition: fs_ofdgraphicsobject.h:26
fs_common.h
通用定义和类的头文件。
foxit::ofd::graphics::OFDGraphicsObject::GetLineJoin
LineJoinMode GetLineJoin()
获取线条连接样式。
foxit::ofd::graphics::OFDGraphicsObject::HasBorder
bool HasBorder()
判断图元对象是否有边框。
foxit::ofd::graphics::BorderInfo::e_LineCapButt
平头端盖。描边在路径的端点处被切断。路径末端之外没有投影。
Definition: fs_ofdgraphicsobject.h:37
foxit::ofd::graphics::OFDGraphicsObject::LineCapMode
LineCapMode
OFD线端点样式枚举。
Definition: fs_ofdgraphicsobject.h:208
foxit::ofd::graphics::OFDGraphicsObject::SetMiterLimit
void SetMiterLimit(float miter_limit)
设置图元对象斜切限制值。
foxit::ofd::graphics::OFDGraphicsObject::e_LineJoinBevel
斜角线条连接类型。
Definition: fs_ofdgraphicsobject.h:248
foxit::ofd::graphics::OFDGraphicsObject::operator=
OFDGraphicsObject & operator=(const OFDGraphicsObject &other)
赋值操作符。
foxit::ofd::graphics::BorderInfo::dash_offset
float dash_offset
虚线偏移量。
Definition: fs_ofdgraphicsobject.h:168
foxit::ofd::graphics::BorderInfo::v_radius
float v_radius
纵向圆角半径。
Definition: fs_ofdgraphicsobject.h:163
foxit::Base
Definition: fs_basictypes.h:465
foxit::ofd::graphics::BorderInfo::color
foxit::RGB color
边框颜色。
Definition: fs_ofdgraphicsobject.h:153
foxit::ofd::graphics::OFDGraphicsObject::GetLineWidth
float GetLineWidth()
获取图元对象线宽。
foxit::ofd::graphics::OFDGraphicsObject::e_LineCapSquare
投影方形端盖。描边在路径端点之外继续延伸等于线宽一半的距离，并被切断。
Definition: fs_ofdgraphicsobject.h:220
foxit::ofd::graphics::OFDGraphicsObject::CreateActions
Actions CreateActions()
创建图元对象动作集合对象。
foxit::ofd::graphics::BorderInfo::e_LineCapRound
圆头端盖。在端点周围绘制一个直径等于线宽的半圆弧并填充。
Definition: fs_ofdgraphicsobject.h:41
foxit::ofd::graphics::OFDGraphicsObject::LineJoinMode
LineJoinMode
OFD线条连接样式枚举。
Definition: fs_ofdgraphicsobject.h:228
foxit::ofd::graphics::OFDGraphicsObject::GetType
ObjectType GetType()
获取图元对象类型。
foxit::ofd::graphics::OFDGraphicsObject::e_ObjectTypeImage
对象类型：图像。
Definition: fs_ofdgraphicsobject.h:198
foxit::ofd::graphics::OFDGraphicsObject::SetMatrix
void SetMatrix(const Matrix &mt)
设置图元对象矩阵。
foxit::ofd::graphics::OFDGraphicsObject::e_ObjectTypeComposite
对象类型：组合。
Definition: fs_ofdgraphicsobject.h:190
foxit::ofd::graphics::OFDGraphicsObject::e_ObjectTypePageBlock
对象类型：页面块。
Definition: fs_ofdgraphicsobject.h:188
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
foxit::ofd::graphics::OFDGraphicsObject::OFDGraphicsObject
OFDGraphicsObject(const OFDGraphicsObject &other)
构造函数，通过另一个OFD图元对象。
CFX_ByteString
字节字符串类
Definition: fx_string.h:317
foxit::ofd::graphics::OFDGraphicsObject::SetBoundary
void SetBoundary(const RectF &boundary)
设置图元对象矩形外接框。
foxit::ofd::graphics::OFDGraphicsObject::e_LineCapRound
圆头端盖。在端点周围绘制一个直径等于线宽的半圆弧并填充。
Definition: fs_ofdgraphicsobject.h:216
foxit::ofd::graphics::BorderInfo::line_width
float line_width
边框宽度，以点为单位。这应该是一个非负值。
Definition: fs_ofdgraphicsobject.h:142
foxit::ofd::graphics::BorderInfo::dash_pattern
foxit::FloatArray dash_pattern
虚线模式数组。
Definition: fs_ofdgraphicsobject.h:173
foxit::ofd::graphics::BorderInfo::LineCapMode
LineCapMode
OFD线端点样式枚举。
Definition: fs_ofdgraphicsobject.h:33
CFX_Matrix
Definition: fx_coordinates.h:1076
foxit::ofd::graphics::OFDGraphicsObject::SetLineWidth
void SetLineWidth(float line_width)
设置图元对象线宽。
CFX_FloatRect
Definition: fx_coordinates.h:771