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 {
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 
foxit::common::Renderer::e_ColorModeForegroundBlackText
如果设置,仅需要替换文本的黑色。
Definition: fs_render.h:246
foxit::common::Renderer::EnableForPrint
void EnableForPrint(bool is_render_for_print)
设置标志来决定是否在打印模式下进行渲染。
foxit::common::Renderer::SetMappingModeColors
void SetMappingModeColors(ARGB background_color, ARGB foreground_color)
当颜色模式为 Renderer::e_ColorModeMappingGray 或 Renderer::e_ColorModeMapping 时设置背景颜色和前景颜色。
foxit::common::Renderer::SetRenderFormField
void SetRenderFormField(bool is_render_formfield)
设置标志来决定是否渲染表单字段(除签名字段外)。
foxit::common::Renderer::SetClearType
void SetClearType(bool is_clear_type)
设置标志来决定是否使用ClearType类似的反锯齿来渲染文本对象。
fs_reflowpage.h
PDF重排页面相关定义和类的头文件。
foxit::common::PrintDeviceSettingData::device_height
int device_height
设备的高度(以像素为单位)。
Definition: fs_render.h:152
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:214
foxit::common::Renderer::SetForceDownSample
void SetForceDownSample(bool is_to_force_down_sample)
设置标志来决定是否对图像拉伸使用下采样。
foxit::common::Renderer::e_RenderScreen
如果设置,仅渲染屏幕注释。
Definition: fs_render.h:232
foxit::common::Renderer::StartRender
Progressive StartRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
开始渲染PDF页面。
foxit::common::Renderer::SetPrintTextAsImage
void SetPrintTextAsImage(bool is_to_print_text_image)
设置标志来决定是否将文本打印为图像。
foxit::common::Renderer::RenderFormControls
bool RenderFormControls(const pdf::PDFPage &page, const Matrix &matrix)
渲染表单控件。
foxit::pdf::annots::Annot
Definition: fs_annot.h:947
foxit::common::Renderer::SetRenderSignatureState
void SetRenderSignatureState(bool is_render_signature_state)
设置标志来决定是否在签名上绘制签名状态。
foxit::common::Renderer::SetRenderLayer
void SetRenderLayer(bool is_render_one_layer)
设置标志来决定是否渲染一个图层或所有可用图层。
foxit::common::Renderer::StartRenderReflowPage
gressive StartRenderReflowPage(const pdf::ReflowPage &reflow_page, const Matrix &matrix, PauseCallback *pause=0)
开始渲染重排页面。
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:221
foxit::common::GraphState
Definition: fs_common.h:1100
foxit::common::Renderer::SetRenderPathThinLine
void SetRenderPathThinLine(bool is_render_path_thin_line)
设置标志来决定是否将路径绘制为细线。
foxit::common::Progressive
Definition: fs_common.h:373
foxit::common::Renderer::ContentFlag
ContentFlag
渲染内容标志的枚举。
Definition: fs_render.h:222
foxit::common::Renderer::SetRenderContentFlags
void SetRenderContentFlags(uint32 render_content_flags)
设置渲染标志来决定渲染什么内容。
foxit::common::PrintDeviceSettingData::copies
uint32 copies
要打印的份数。此参数仅对PostScript文件有效。
Definition: fs_render.h:168
fs_common.h
通用定义和类的头文件。
foxit::common::Renderer::e_RenderHighlight
如果设置,仅渲染高亮注释。
Definition: fs_render.h:228
foxit::common::Renderer::ColorModeForeground
ColorModeForeground
渲染前景颜色模式的枚举。
Definition: fs_render.h:240
foxit::ARGB
uint32 ARGB
ARGB 颜色类型,32 位,((b) | ((g) << 8) | ((r) << 16)) | ((a) << 24)
Definition: fs_basictypes.h:210
foxit::common::PrintDeviceSettingData::resolution
int resolution
设备的分辨率,以每英寸像素数为单位。
Definition: fs_render.h:166
foxit::common::PrintDeviceSettingData::device_width
int device_width
设备的宽度(以像素为单位)。
Definition: fs_render.h:150
foxit::common::Path
Definition: fs_common.h:2167
foxit::common::Renderer::RenderGraphicsObject
bool RenderGraphicsObject(const pdf::graphics::GraphicsObject *graphics_object, const pdf::PDFPage &page, const Matrix &matrix)
渲染图形对象。
foxit::common::Renderer::SetLayerContext
void SetLayerContext(const pdf::LayerContext &layer_context)
设置图层上下文到渲染上下文句柄。
foxit::common::Renderer::e_DevicePrinter
设备类型:打印机。
Definition: fs_render.h:261
fs_pdflayer.h
PDF图层相关定义和类的头文件。
fs_xfa.h
XFA 相关定义和函数的头文件。
foxit::common::Renderer::SetForegroundColorMode
void SetForegroundColorMode(uint32 foreground_color_mode)
当颜色模式为 Renderer::e_ColorModeForeground 时设置渲染前景颜色模式。
foxit::common::Renderer::SetRenderSignature
void SetRenderSignature(bool is_render_signature)
设置标志来决定是否渲染签名。
foxit::common::Renderer::SetClipPathStroke
void SetClipPathStroke(const Path &clip_path, const Matrix &matrix, const GraphState *graph_state=0)
使用描边区域设置裁剪路径。
foxit::pdf::LayerContext
Definition: fs_pdflayer.h:337
foxit::pdf::annots::Annot::AppearanceType
AppearanceType
注释外观类型的枚举。
Definition: fs_annot.h:1225
foxit::common::Renderer::e_ColorModeForegroundBlackPath
如果设置,仅需要替换路径的黑色。
Definition: fs_render.h:248
foxit::common::Renderer::DeviceType
DeviceType
渲染设备类型的枚举。
Definition: fs_render.h:257
foxit::common::Renderer::StartQuickRender
Progressive StartQuickRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
开始快速渲染PDF页面,主要用于缩略图。
foxit::common::Renderer::SetForegroundColor
void SetForegroundColor(ARGB foreground_color)
当颜色模式为 Renderer::e_ColorModeForeground 时为文本、路径或两者设置前景颜色。
foxit::common::Renderer::e_RenderExceptHighlight
如果设置,将渲染除高亮外的所有注释。
Definition: fs_render.h:230
foxit::pdf::graphics::GraphicsObject
Definition: fs_pdfgraphicsobject.h:232
foxit::common::Renderer::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::common::Renderer::e_RenderPage
如果设置,将渲染页面内容。
Definition: fs_render.h:224
foxit::common::PrintDeviceSettingData::e_Portrait
打印的纵向方向。
Definition: fs_render.h:59
foxit::common::Renderer::RenderAnnot
bool RenderAnnot(const pdf::annots::Annot &annot, const Matrix &matrix)
渲染指定的注释。
foxit::common::FillMode
FillMode
填充模式类型枚举,主要用于路径图形对象。
Definition: fs_common.h:108
foxit::common::Renderer::SetClipRect
void SetClipRect(const RectI *clip_rect)
设置将在后续渲染过程中使用的裁剪矩形。
foxit::pdf::ReflowPage
Definition: fs_reflowpage.h:61
foxit::common::Renderer::SetRenderImageAntiAliasing
void SetRenderImageAntiAliasing(bool is_render_image_antialiasing)
设置标志来决定是否绘制图像反锯齿。
foxit::common::Renderer::StartRenderBitmap
Progressive StartRenderBitmap(const Bitmap &bitmap, const Matrix &matrix, const RectI *clip_rect=0, uint32 interpolation=0, PauseCallback *pause=0)
开始渲染位图。
foxit::common::Renderer::SetClipPathFill
void SetClipPathFill(const Path &clip_path, const Matrix &matrix, foxit::common::FillMode fill_mode)
使用填充区域设置裁剪路径。
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
foxit::common::Renderer::e_ColorModeForegroundPath
如果设置,需要替换路径的颜色。
Definition: fs_render.h:244
foxit::common::Renderer::SetRenderEnhanceThinLines
void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines)
设置标志来决定是否增强细线。
foxit::common::Renderer::ColorMode
ColorMode
渲染颜色模式的枚举。
Definition: fs_render.h:204
foxit::common::Renderer::SetScreenDPIScale
void SetScreenDPIScale(float scale)
设置用于渲染的屏幕DPI缩放因子。
foxit::common::PrintDeviceSettingData::operator=
PrintDeviceSettingData & operator=(const PrintDeviceSettingData &settings)
赋值操作符。
Definition: fs_render.h:117
foxit::common::Renderer::SetRenderAnnotsForThumbnail
void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail)
设置渲染标志来决定是否在缩略图模式下渲染注释。
foxit::common::Renderer::e_ColorModeMappingGray
将灰阶:白色/黑色颜色值映射到背景/前景;其他颜色不变。
Definition: fs_render.h:208
foxit::common::Renderer::e_RenderAnnot
如果设置,将渲染注释。
Definition: fs_render.h:226
IFX_Pause
Definition: fx_basic.h:3737
fs_image.h
图像和位图相关定义和类的头文件。
foxit::common::PrintDeviceSettingData::device_margin
RectF device_margin
设备的页边距。
Definition: fs_render.h:159
foxit::common::Renderer::SetRenderTextAntiAliasing
void SetRenderTextAntiAliasing(bool is_render_text_antialiasing)
设置标志来决定是否绘制文本反锯齿。
foxit::common::Renderer::e_ColorModeAlpha
仅输出alpha,忽略颜色。
Definition: fs_render.h:212
foxit::common::Renderer::SetColorMode
void SetColorMode(ColorMode color_mode)
设置颜色模式。
foxit::common::PrintDeviceSettingData::orientation
OrientationFlag orientation
方向标志。请参考从 OrientationFlag::e_Portrait 开始的值, 这应该是其中的一个值。
Definition: fs_render.h:164
foxit::common::PrintDeviceSettingData::e_Landscape
打印的横向方向。
Definition: fs_render.h:61
foxit::common::PrintDeviceSettingData::PrintDeviceSettingData
PrintDeviceSettingData(const PrintDeviceSettingData &settings)
带另一个打印设备设置数据对象的构造函数。
Definition: fs_render.h:102
foxit::common::Renderer::SetForceHalftone
void SetForceHalftone(bool is_to_force_halftone)
设置标志来决定是否对图像拉伸使用半调。
foxit::common::PrintDeviceSettingData::Set
void Set(int device_width, int device_height, RectF device_margin, OrientationFlag orientation, int resolution, uint32 copies)
设置值。
Definition: fs_render.h:141
foxit::common::PrintDeviceSettingData::PrintDeviceSettingData
PrintDeviceSettingData()
构造函数并设置默认值。
Definition: fs_render.h:90
foxit::common::Renderer::operator=
Renderer & operator=(const Renderer &other)
赋值操作符。
foxit::common::Renderer::operator==
bool operator==(const Renderer &other) const
相等操作符。
NULL
#define NULL
空指针值。
Definition: fx_system.h:792
CFX_FloatRect
Definition: fx_coordinates.h:771
foxit::common::Renderer::e_ColorModeForegroundText
如果设置,需要替换文本的颜色。
Definition: fs_render.h:242
foxit::pdf::PDFPage
Definition: fs_pdfpage.h:421
foxit::common::Renderer::SetPrintTextAsGraphic
void SetPrintTextAsGraphic(bool is_to_print_text_graphic)
设置标志来决定是否将文本打印为路径或位图。
foxit::common::Renderer::SetOverprint
void SetOverprint(bool is_to_enable_overprint)
设置标志来决定是否启用叠印。
foxit::common::Renderer::operator!=
bool operator!=(const Renderer &other) const
不等操作符。
foxit::common::Renderer::ClearClips
void ClearClips()
清除通过函数 Renderer::SetClipRect 设置的裁剪矩形。
foxit::addon::xfa::XFAPage
Definition: fs_xfa.h:1334
foxit::common::Renderer::e_ColorModeNormal
正常颜色模式。
Definition: fs_render.h:206
foxit::common::PrintDeviceSettingData
Definition: fs_render.h:50
foxit::common::Renderer::SetRenderAnnotAppearanceType
void SetRenderAnnotAppearanceType(foxit::pdf::annots::Annot::AppearanceType ap_type)
设置注释的外观类型用于渲染。
foxit::common::Renderer::~Renderer
~Renderer()
析构函数。
foxit::common::Renderer::e_ColorModeMapping
将颜色值映射到由背景颜色和前景颜色定义的颜色范围。
Definition: fs_render.h:210
foxit::common::PrintDeviceSettingData::OrientationFlag
OrientationFlag
用于指定打印机方向的枚举。
Definition: fs_render.h:57
FX_RECT
Definition: fx_coordinates.h:596
CFX_Matrix
Definition: fx_coordinates.h:1076
fs_annot.h
注释相关定义和类的头文件。
foxit::common::Renderer::e_DeviceDisplay
设备类型:显示设备。
Definition: fs_render.h:259
foxit::common::Renderer::SetRenderPathAntiAliasing
void SetRenderPathAntiAliasing(bool is_render_path_antialiasing)
设置标志来决定是否绘制路径反锯齿。
foxit::common::Bitmap
Definition: fs_image.h:36
foxit::common::Renderer::StartRenderXFAPage
Progressive StartRenderXFAPage(const addon::xfa::XFAPage &xfa_page_view, const Matrix &matrix, bool is_highlight, PauseCallback *pause=0)
开始渲染XFA页面。
foxit::common::Renderer::SetJPXDownSample
void SetJPXDownSample(bool is_jpx_down_sample)
设置标志来决定是否对jpx图像使用下采样。
foxit::uint32
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:196
foxit::common::PrintDeviceSettingData::PrintDeviceSettingData
PrintDeviceSettingData(int device_width, int device_height, RectF device_margin, OrientationFlag orientation, int resolution, uint32 copies)
带参数的构造函数。
Definition: fs_render.h:76
foxit::common::Renderer
Definition: fs_render.h:197
foxit::common::Renderer::Renderer
Renderer(const Bitmap &bitmap, bool is_rgb_order)
带位图的构造函数。
foxit::Base
Definition: fs_basictypes.h:449
foxit::common::Renderer::SetJPEGDownSample
void SetJPEGDownSample(bool is_jepg_down_sample)
设置标志来决定是否对jpeg图像使用下采样。
foxit::common::Renderer::SetRenderPathFullCovered
void SetRenderPathFullCovered(bool is_render_path_full_covered)
可应用于填充模式的特殊标志。
foxit::common::Renderer::e_ColorModeForeground
自定义颜色模式。将颜色映射到前景。
Definition: fs_render.h:214