Foxit PDF SDK
fs_render.h
Go to the documentation of this file.
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
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 {
70 class Renderer FS_FINAL : public Base {
71  public:
77  typedef enum _ColorMode {
84  } ColorMode;
85 
91  typedef enum _ContentFlag {
93  e_RenderPage = 0x01,
96  } ContentFlag;
97 
98  #ifdef __APPLE__
99 
104  typedef enum _DeviceType {
109  }DeviceType;
110  #endif
111 
124  Renderer(const Bitmap& bitmap, bool is_rgb_order);
125 
126 #if (defined(_WIN32) || defined(_WIN64)) && (!defined(SWIG) || defined(_SWIG_DOTNET_))
127 
134  explicit Renderer(HDC dc);
135 #endif
136 
137 #ifdef __APPLE__
138 
148  Renderer(const CGContextRef& context, DeviceType device_type);
149 #endif
150 
155  Renderer(const Renderer& other);
157  ~Renderer();
158 
166  Renderer& operator = (const Renderer& other);
174  bool operator == (const Renderer& other) const;
182  bool operator != (const Renderer& other) const;
183 
191  bool IsEmpty() const;
192 
216  Progressive StartQuickRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
217 
248  Progressive StartRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
249 #ifndef __EMSCRIPTEN_RENDER__
250 
268  Progressive StartRenderReflowPage(const pdf::ReflowPage& reflow_page, const Matrix& matrix,
269  PauseCallback* pause = NULL);
270 
271 #ifndef _FX_NO_XFA_
272 
292  Progressive StartRenderXFAPage(const addon::xfa::XFAPage& xfa_page_view, const Matrix& matrix, bool is_highlight,
293  PauseCallback* pause = NULL);
294 #endif
295 #endif
296 
321  Progressive StartRenderBitmap(const Bitmap& bitmap, const Matrix& matrix,
322  const RectI* clip_rect = NULL, uint32 interpolation = 0,
323  PauseCallback* pause = NULL);
324 #ifndef __EMSCRIPTEN_RENDER__
325 
334 
348  bool RenderAnnot(const pdf::annots::Annot& annot, const Matrix& matrix);
349 #endif
350 
362  bool RenderFormControls(const pdf::PDFPage& page, const Matrix& matrix);
363 #ifndef __EMSCRIPTEN_RENDER__
364 
377  bool RenderGraphicsObject(const pdf::graphics::GraphicsObject* graphics_object, const pdf::PDFPage& page, const Matrix& matrix);
378 #endif
379 
387  void SetClipRect(const RectI* clip_rect);
388 
399  void SetClipPathFill(const Path& clip_path, const Matrix& matrix, foxit::common::FillMode fill_mode);
400 
410  void SetClipPathStroke(const Path& clip_path, const Matrix& matrix, const GraphState* graph_state = NULL);
411 
424  void SetRenderContentFlags(uint32 render_content_flags);
425 
440  void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail);
441 
455  void SetRenderFormField(bool is_render_formfield);
456 
470  void SetRenderSignature(bool is_render_signature);
471 #ifndef __EMSCRIPTEN_RENDER__
472 
482  void SetLayerContext(const pdf::LayerContext& layer_context);
483 #endif
484 
507  void SetColorMode(ColorMode color_mode);
517  void SetMappingModeColors(ARGB background_color, ARGB foreground_color);
518 
529  void SetClearType(bool is_clear_type);
542  void SetPrintTextAsGraphic(bool is_to_print_text_graphic);
543 
554  void SetPrintTextAsImage(bool is_to_print_text_image);
555 
566  void SetForceDownSample(bool is_to_force_down_sample);
567 
580  void EnableForPrint(bool is_render_for_print);
581 
592  void SetForceHalftone(bool is_to_force_halftone);
593 
604  void SetRenderPathThinLine(bool is_render_path_thin_line);
605 
616  void SetRenderTextAntiAliasing(bool is_render_text_antialiasing);
617 
628  void SetRenderPathAntiAliasing(bool is_render_path_antialiasing);
629 
641  void SetRenderImageAntiAliasing(bool is_render_image_antialiasing);
642 
643  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
644  explicit Renderer(FS_HANDLE handle = NULL);
645 };
646 } // namespace common
647 } // namespace foxit
648 #endif // FS_RENDER_H_
649 
void EnableForPrint(bool is_render_for_print)
Set the flag to decide whether to do rendering in print mode.
void SetMappingModeColors(ARGB background_color, ARGB foreground_color)
Set background color and foreground color when color mode is Renderer::e_ColorModeMappingGray or Rend...
Progressive StartRenderReflowPage(const pdf::ReflowPage &reflow_page, const Matrix &matrix, PauseCallback *pause=0)
Start to render a reflow page.
void SetRenderFormField(bool is_render_formfield)
Set the flag to decide whether to render form fields (except signature fields).
void SetClearType(bool is_clear_type)
Set the flag to decide whether to use ClearType-like anti-aliasing to render text objects.
Header file for PDF reflow page related definitions and classes.
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:216
void SetForceDownSample(bool is_to_force_down_sample)
Set the flag to decide whether to use down-sampling for image stretching.
Progressive StartRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
Start to render a PDF page.
void SetPrintTextAsImage(bool is_to_print_text_image)
Set the flag to decide whether to print text as image.
bool RenderFormControls(const pdf::PDFPage &page, const Matrix &matrix)
Render form controls.
Definition: fs_annot.h:754
Definition: fs_common.h:996
void SetRenderPathThinLine(bool is_render_path_thin_line)
Set the flag to decide whether to draw path as thin line.
Definition: fs_common.h:568
ContentFlag
Enumeration for rendering content flags.
Definition: fs_render.h:91
void SetRenderContentFlags(uint32 render_content_flags)
Set rendering flag to decide what content will be rendered.
Header file for common definitions and classes.
uint32 ARGB
ARGB color type, 32 bits, ((b) | ((g) << 8) | ((r) << 16)) | ((a) << 24)
Definition: fs_basictypes.h:212
Definition: fs_common.h:1982
bool RenderGraphicsObject(const pdf::graphics::GraphicsObject *graphics_object, const pdf::PDFPage &page, const Matrix &matrix)
Render a graphics object.
void SetLayerContext(const pdf::LayerContext &layer_context)
Set layer context to render context handle.
Device type: printer.
Definition: fs_render.h:108
Header file for PDF layer related definitions and classes.
Header file for XFA related definitions and functions.
void SetRenderSignature(bool is_render_signature)
Set the flag to decide whether to render signatures or not.
void SetClipPathStroke(const Path &clip_path, const Matrix &matrix, const GraphState *graph_state=0)
Set clipping path using stroked region.
Definition: fs_pdflayer.h:246
AppearanceType
Enumeration for the type of annotation's appearance.
Definition: fs_annot.h:1030
DeviceType
Enumeration for rendering device type.
Definition: fs_render.h:104
Progressive StartQuickRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
Start to quickly render a PDF page, mainly for thumbnail purpose.
Definition: fs_pdfgraphicsobject.h:241
bool IsEmpty() const
Check whether current object is empty or not.
If set, page content will be rendered.
Definition: fs_render.h:93
bool RenderAnnot(const pdf::annots::Annot &annot, const Matrix &matrix)
Render a specified annotation.
FillMode
Enumeration for filling mode type, mainly for path graphics object.
Definition: fs_common.h:376
void SetClipRect(const RectI *clip_rect)
Set the clipping rectangle which will be used in following rendering progress.
Definition: fs_reflowpage.h:62
void SetRenderImageAntiAliasing(bool is_render_image_antialiasing)
Set the flag to decide whether to draw image anti-aliasing.
Progressive StartRenderBitmap(const Bitmap &bitmap, const Matrix &matrix, const RectI *clip_rect=0, uint32 interpolation=0, PauseCallback *pause=0)
Start to render a bitmap.
void SetClipPathFill(const Path &clip_path, const Matrix &matrix, foxit::common::FillMode fill_mode)
Set clipping path using filled region.
Foxit namespace.
Definition: fs_compare.h:27
ColorMode
Enumeration for rendering color mode.
Definition: fs_render.h:77
void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail)
Set rendering flag to decide whether to render annotations in thumbnail mode or not.
Map gray/white/black color value to background/foreground; for other colors, no change.
Definition: fs_render.h:81
If set, annotations will be rendered.
Definition: fs_render.h:95
Definition: fx_basic.h:3752
Header file for image and bitmap related definitions and classes.
void SetRenderTextAntiAliasing(bool is_render_text_antialiasing)
Set the flag to decide whether to draw text anti-aliasing.
void SetColorMode(ColorMode color_mode)
Set color mode.
void SetForceHalftone(bool is_to_force_halftone)
Set the flag to decide whether to use halftone for image stretching.
Renderer & operator=(const Renderer &other)
Assign operator.
bool operator==(const Renderer &other) const
Equal operator.
#define NULL
The null-pointer value.
Definition: fx_system.h:767
Definition: fs_pdfpage.h:342
void SetPrintTextAsGraphic(bool is_to_print_text_graphic)
Set the flag to decide whether to print text as path or bitmap.
Definition: fs_xfa.h:1222
Normal color mode.
Definition: fs_render.h:79
void SetRenderAnnotAppearanceType(foxit::pdf::annots::Annot::AppearanceType ap_type)
Set the annotation's appearance type for rendering.
bool operator !=(const Renderer &other) const
Not equal operator.
Map a color value to the color range defined by a background color and a foreground color.
Definition: fs_render.h:83
Definition: fx_coordinates.h:596
Definition: fx_coordinates.h:1076
Header file for annotation related definitions and classes.
Device type: display device.
Definition: fs_render.h:106
void SetRenderPathAntiAliasing(bool is_render_path_antialiasing)
Set the flag to decide whether to draw path anti-aliasing.
Definition: fs_image.h:36
Progressive StartRenderXFAPage(const addon::xfa::XFAPage &xfa_page_view, const Matrix &matrix, bool is_highlight, PauseCallback *pause=0)
Start to render an XFA page.
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:198
Definition: fs_render.h:70
Renderer(const Bitmap &bitmap, bool is_rgb_order)
Constructor, with bitmap.
Definition: fs_basictypes.h:399