Foxit PDF SDK
fs_render.h
浏览该文件的文档.
1 
15 #ifndef FS_RENDER_H_
16 #define FS_RENDER_H_
17 
18 #include "common/fs_common.h"
19 #include "common/fs_image.h"
20 #ifndef __EMSCRIPTEN_RENDER__
21 #include "pdf/annots/fs_annot.h"
22 #include "pdf/fs_pdflayer.h"
23 #include "pdf/fs_reflowpage.h"
24 #ifndef _FX_NO_XFA_
25 #include "addon/xfa/fs_xfa.h"
26 #endif // #ifndef _FX_NO_XFA_
27 #endif
28 
29 #ifdef __APPLE__
30 #include <CoreGraphics/CoreGraphics.h>
31 #endif
32 
37 namespace foxit {
38 namespace pdf {
39 class PDFPage;
40 }
44 namespace common {
50 class PrintDeviceSettingData FS_FINAL : public Object{
51  public:
57  typedef enum _OrientationFlag {
63 
82  , copies(copies){}
83 
91  : device_width(2479)
92  , device_height(3508)
94  , resolution(300)
95  , copies(1) {}
96 
103  : device_width(settings.device_width)
104  , device_height(settings.device_height)
105  , device_margin(settings.device_margin)
106  , orientation(settings.orientation)
107  , resolution(settings.resolution)
108  , copies(settings.copies) {}
109 
118  device_width = settings.device_width;
119  device_height = settings.device_height;
120  device_margin = settings.device_margin;
121  orientation = settings.orientation;
122  resolution = settings.resolution;
123  copies = settings.copies;
124  return *this;
125  }
126 
142  this->device_width = device_width;
143  this->device_height = device_height;
144  this->device_margin = device_margin;
145  this->orientation = orientation;
146  this->resolution = resolution;
147  this->copies = copies;
148  }
169 };
170 
197 class Renderer FS_FINAL : public Base {
198  public:
204  typedef enum _ColorMode {
215  } ColorMode;
216 
222  typedef enum _ContentFlag {
224  e_RenderPage = 0x01,
233  } ContentFlag;
234 
240  typedef enum _ColorModeForeground {
250 
251  #ifdef __APPLE__
252 
257  typedef enum _DeviceType {
259  e_DeviceDisplay = 1,
261  e_DevicePrinter = 2
262  }DeviceType;
263  #endif
264 
277  Renderer(const Bitmap& bitmap, bool is_rgb_order);
278 
291  Renderer(const PrintDeviceSettingData& print_param, const wchar_t* dest_file_path);
292 
293 #if (defined(_WIN32) || defined(_WIN64)) && (!defined(SWIG) || defined(_SWIG_DOTNET_) || defined(_SWIG_PYTHON_))
294 
301  explicit Renderer(HDC dc);
302 
312  Renderer(HDC dc, const wchar_t* printer_driver_name);
313 #endif
314 
315 #ifdef __APPLE__
316 
326  Renderer(const CGContextRef& context, DeviceType device_type);
327 #endif
328 
334  Renderer(const Renderer& other);
336  ~Renderer();
337 
345  Renderer& operator = (const Renderer& other);
353  bool operator == (const Renderer& other) const;
361  bool operator != (const Renderer& other) const;
362 
370  bool IsEmpty() const;
371 
393  Progressive StartQuickRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
394 
425  Progressive StartRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
426 #ifndef __EMSCRIPTEN_RENDER__
427 gressive StartRenderReflowPage(const pdf::ReflowPage& reflow_page, const Matrix& matrix,
445  PauseCallback* pause = NULL);
446 
447 #ifndef _FX_NO_XFA_
448 
467  Progressive StartRenderXFAPage(const addon::xfa::XFAPage& xfa_page_view, const Matrix& matrix, bool is_highlight,
468  PauseCallback* pause = NULL);
469 #endif // #ifndef _FX_NO_XFA_
470 #endif
471 
495  Progressive StartRenderBitmap(const Bitmap& bitmap, const Matrix& matrix,
496  const RectI* clip_rect = NULL, uint32 interpolation = 0,
497  PauseCallback* pause = NULL);
498 
523  Progressive StartRenderBitmap(const Bitmap& bitmap, const Matrix& matrix,
524  const RectI* clip_rect, uint32 interpolation,
525  uint32 alpha, PauseCallback* pause);
526 
527 #ifndef __EMSCRIPTEN_RENDER__
528 
537 
551  bool RenderAnnot(const pdf::annots::Annot& annot, const Matrix& matrix);
552 #endif
553 
565  bool RenderFormControls(const pdf::PDFPage& page, const Matrix& matrix);
566 #ifndef __EMSCRIPTEN_RENDER__
567 
580  bool RenderGraphicsObject(const pdf::graphics::GraphicsObject* graphics_object, const pdf::PDFPage& page, const Matrix& matrix);
581 #endif
582 
591  void SetClipRect(const RectI* clip_rect);
592 
598  void ClearClips();
599 
610  void SetClipPathFill(const Path& clip_path, const Matrix& matrix, foxit::common::FillMode fill_mode);
611 
622  void SetClipPathStroke(const Path& clip_path, const Matrix& matrix, const GraphState* graph_state = NULL);
623 
637  void SetRenderContentFlags(uint32 render_content_flags);
638 
653  void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail);
654 
665  void SetRenderFormField(bool is_render_formfield);
666 
677  void SetRenderSignature(bool is_render_signature);
678 #ifndef __EMSCRIPTEN_RENDER__
679 
689  void SetLayerContext(const pdf::LayerContext& layer_context);
690 
701  void SetRenderLayer(bool is_render_one_layer);
702 #endif
703 
726  void SetColorMode(ColorMode color_mode);
736  void SetMappingModeColors(ARGB background_color, ARGB foreground_color);
737 
751  void SetForegroundColorMode(uint32 foreground_color_mode);
752 
763  void SetForegroundColor(ARGB foreground_color);
764 
775  void SetClearType(bool is_clear_type);
788  void SetPrintTextAsGraphic(bool is_to_print_text_graphic);
789 
800  void SetPrintTextAsImage(bool is_to_print_text_image);
801 
812  void SetForceDownSample(bool is_to_force_down_sample);
813 
823  void SetOverprint(bool is_to_enable_overprint);
824 
838  void SetJPEGDownSample(bool is_jepg_down_sample);
839 
853  void SetJPXDownSample(bool is_jpx_down_sample);
854 
867  void EnableForPrint(bool is_render_for_print);
868 
879  void SetForceHalftone(bool is_to_force_halftone);
880 
891  void SetRenderPathThinLine(bool is_render_path_thin_line);
892 
903  void SetRenderTextAntiAliasing(bool is_render_text_antialiasing);
904 
915  void SetRenderPathAntiAliasing(bool is_render_path_antialiasing);
916 
926  void SetRenderPathFullCovered(bool is_render_path_full_covered);
927 
939  void SetRenderImageAntiAliasing(bool is_render_image_antialiasing);
940 
952  void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines);
953 
962  void SetRenderSignatureState(bool is_render_signature_state);
963 
964  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
965  explicit Renderer(FS_HANDLE handle = NULL);
966 
982  void SetScreenDPIScale(float scale);
983 
984 };
985 } // namespace common
986 } // namespace foxit
987 #endif // FS_RENDER_H_
988 
Definition: fs_pdfgraphicsobject.h:232
void SetRenderContentFlags(uint32 render_content_flags)
设置渲染标志来决定渲染什么内容。
PrintDeviceSettingData()
构造函数并设置默认值。
Definition: fs_render.h:90
PDF重排页面相关定义和类的头文件。
void ClearClips()
清除通过函数 Renderer::SetClipRect 设置的裁剪矩形。
Progressive StartRenderBitmap(const Bitmap &bitmap, const Matrix &matrix, const RectI *clip_rect=0, uint32 interpolation=0, PauseCallback *pause=0)
开始渲染位图。
Definition: fs_reflowpage.h:61
void SetRenderAnnotAppearanceType(foxit::pdf::annots::Annot::AppearanceType ap_type)
设置注释的外观类型用于渲染。
PrintDeviceSettingData(int device_width, int device_height, RectF device_margin, OrientationFlag orientation, int resolution, uint32 copies)
带参数的构造函数。
Definition: fs_render.h:76
Renderer & operator=(const Renderer &other)
赋值操作符。
void Set(int device_width, int device_height, RectF device_margin, OrientationFlag orientation, int resolution, uint32 copies)
设置值。
Definition: fs_render.h:141
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:221
IFX_Pause PauseCallback
Definition: fs_common.h:1288
ColorModeForeground
渲染前景颜色模式的枚举。
Definition: fs_render.h:240
void SetJPXDownSample(bool is_jpx_down_sample)
设置标志来决定是否对jpx图像使用下采样。
void SetRenderImageAntiAliasing(bool is_render_image_antialiasing)
设置标志来决定是否绘制图像反锯齿。
Progressive StartQuickRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
开始快速渲染PDF页面,主要用于缩略图。
如果设置,需要替换文本的颜色。
Definition: fs_render.h:242
Definition: fs_xfa.h:1334
void EnableForPrint(bool is_render_for_print)
设置标志来决定是否在打印模式下进行渲染。
void SetOverprint(bool is_to_enable_overprint)
设置标志来决定是否启用叠印。
void SetClipRect(const RectI *clip_rect)
设置将在后续渲染过程中使用的裁剪矩形。
如果设置,将渲染页面内容。
Definition: fs_render.h:224
~Renderer()
析构函数。
void SetRenderPathAntiAliasing(bool is_render_path_antialiasing)
设置标志来决定是否绘制路径反锯齿。
ColorMode
渲染颜色模式的枚举。
Definition: fs_render.h:204
bool IsEmpty() const
检查当前对象是否为空。
Progressive StartRenderXFAPage(const addon::xfa::XFAPage &xfa_page_view, const Matrix &matrix, bool is_highlight, PauseCallback *pause=0)
开始渲染XFA页面。
uint32 copies
要打印的份数。此参数仅对PostScript文件有效。
Definition: fs_render.h:168
void SetRenderTextAntiAliasing(bool is_render_text_antialiasing)
设置标志来决定是否绘制文本反锯齿。
void SetForceHalftone(bool is_to_force_halftone)
设置标志来决定是否对图像拉伸使用半调。
PrintDeviceSettingData(const PrintDeviceSettingData &settings)
带另一个打印设备设置数据对象的构造函数。
Definition: fs_render.h:102
void SetJPEGDownSample(bool is_jepg_down_sample)
设置标志来决定是否对jpeg图像使用下采样。
PDF图层相关定义和类的头文件。
图像和位图相关定义和类的头文件。
自定义颜色模式。将颜色映射到前景。
Definition: fs_render.h:214
将灰阶:白色/黑色颜色值映射到背景/前景;其他颜色不变。
Definition: fs_render.h:208
void SetColorMode(ColorMode color_mode)
设置颜色模式。
gressive StartRenderReflowPage(const pdf::ReflowPage &reflow_page, const Matrix &matrix, PauseCallback *pause=0)
开始渲染重排页面。
Definition: fs_render.h:197
void SetRenderPathFullCovered(bool is_render_path_full_covered)
可应用于填充模式的特殊标志。
void SetClipPathFill(const Path &clip_path, const Matrix &matrix, foxit::common::FillMode fill_mode)
使用填充区域设置裁剪路径。
uint32 ARGB
ARGB 颜色类型,32 位,((b) | ((g) << 8) | ((r) << 16)) | ((a) << 24)
Definition: fs_basictypes.h:210
void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail)
设置渲染标志来决定是否在缩略图模式下渲染注释。
int device_width
设备的宽度(以像素为单位)。
Definition: fs_render.h:150
void SetClearType(bool is_clear_type)
设置标志来决定是否使用ClearType类似的反锯齿来渲染文本对象。
注释相关定义和类的头文件。
FillMode
填充模式类型枚举,主要用于路径图形对象。
Definition: fs_common.h:108
OrientationFlag
用于指定打印机方向的枚举。
Definition: fs_render.h:57
Renderer(const Bitmap &bitmap, bool is_rgb_order)
带位图的构造函数。
void SetRenderPathThinLine(bool is_render_path_thin_line)
设置标志来决定是否将路径绘制为细线。
int resolution
设备的分辨率,以每英寸像素数为单位。
Definition: fs_render.h:166
void SetRenderFormField(bool is_render_formfield)
设置标志来决定是否渲染表单字段(除签名字段外)。
将颜色值映射到由背景颜色和前景颜色定义的颜色范围。
Definition: fs_render.h:210
如果设置,将渲染注释。
Definition: fs_render.h:226
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:196
如果设置,仅需要替换文本的黑色。
Definition: fs_render.h:246
Definition: fs_pdfpage.h:421
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:214
PrintDeviceSettingData & operator=(const PrintDeviceSettingData &settings)
赋值操作符。
Definition: fs_render.h:117
通用定义和类的头文件。
Progressive StartRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
开始渲染PDF页面。
正常颜色模式。
Definition: fs_render.h:206
bool operator !=(const Renderer &other) const
不等操作符。
void SetForegroundColor(ARGB foreground_color)
当颜色模式为 Renderer::e_ColorModeForeground 时为文本、路径或两者设置前景颜色。
打印的横向方向。
Definition: fs_render.h:61
Definition: fx_coordinates.h:596
OrientationFlag orientation
方向标志。请参考从 OrientationFlag::e_Portrait 开始的值, 这应该是其中的一个值。
Definition: fs_render.h:164
如果设置,需要替换路径的颜色。
Definition: fs_render.h:244
如果设置,仅需要替换路径的黑色。
Definition: fs_render.h:248
Definition: fs_render.h:50
仅输出alpha,忽略颜色。
Definition: fs_render.h:212
Definition: fs_basictypes.h:449
如果设置,仅渲染高亮注释。
Definition: fs_render.h:228
Definition: fs_pdflayer.h:337
bool RenderGraphicsObject(const pdf::graphics::GraphicsObject *graphics_object, const pdf::PDFPage &page, const Matrix &matrix)
渲染图形对象。
void SetLayerContext(const pdf::LayerContext &layer_context)
设置图层上下文到渲染上下文句柄。
void SetForceDownSample(bool is_to_force_down_sample)
设置标志来决定是否对图像拉伸使用下采样。
XFA 相关定义和函数的头文件。
bool RenderAnnot(const pdf::annots::Annot &annot, const Matrix &matrix)
渲染指定的注释。
Definition: fs_annot.h:947
void SetRenderSignature(bool is_render_signature)
设置标志来决定是否渲染签名。
Foxit命名空间。
Definition: fs_taggedpdf.h:27
int device_height
设备的高度(以像素为单位)。
Definition: fs_render.h:152
AppearanceType
注释外观类型的枚举。
Definition: fs_annot.h:1225
void SetPrintTextAsImage(bool is_to_print_text_image)
设置标志来决定是否将文本打印为图像。
ContentFlag
渲染内容标志的枚举。
Definition: fs_render.h:222
void SetMappingModeColors(ARGB background_color, ARGB foreground_color)
当颜色模式为 Renderer::e_ColorModeMappingGray 或 Renderer::e_ColorModeMapping 时设置背景颜色和前景颜色。
打印的纵向方向。
Definition: fs_render.h:59
#define NULL
空指针值。
Definition: fx_system.h:792
void SetForegroundColorMode(uint32 foreground_color_mode)
当颜色模式为 Renderer::e_ColorModeForeground 时设置渲染前景颜色模式。
bool operator==(const Renderer &other) const
相等操作符。
void SetRenderSignatureState(bool is_render_signature_state)
设置标志来决定是否在签名上绘制签名状态。
RectF device_margin
设备的页边距。
Definition: fs_render.h:159
Definition: fx_coordinates.h:1076
void SetPrintTextAsGraphic(bool is_to_print_text_graphic)
设置标志来决定是否将文本打印为路径或位图。
如果设置,仅渲染屏幕注释。
Definition: fs_render.h:232
如果设置,将渲染除高亮外的所有注释。
Definition: fs_render.h:230
bool RenderFormControls(const pdf::PDFPage &page, const Matrix &matrix)
渲染表单控件。
void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines)
设置标志来决定是否增强细线。
void SetClipPathStroke(const Path &clip_path, const Matrix &matrix, const GraphState *graph_state=0)
使用描边区域设置裁剪路径。
void SetRenderLayer(bool is_render_one_layer)
设置标志来决定是否渲染一个图层或所有可用图层。
Definition: fx_coordinates.h:771
void SetScreenDPIScale(float scale)
设置用于渲染的屏幕DPI缩放因子。