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 // #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 {
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 {
106  e_DeviceDisplay = 1,
108  e_DevicePrinter = 2
109  }DeviceType;
110  #endif
111 
125  Renderer(const Bitmap& bitmap, bool is_rgb_order);
126 
127 #if (defined(_WIN32) || defined(_WIN64)) && (!defined(SWIG) || defined(_SWIG_DOTNET_) || defined(_SWIG_PYTHON_))
128 
135  explicit Renderer(HDC dc);
136 
146  Renderer(HDC dc, const wchar_t* printer_driver_name);
147 #endif
148 
149 #ifdef __APPLE__
150 
160  Renderer(const CGContextRef& context, DeviceType device_type);
161 #endif
162 
167  Renderer(const Renderer& other);
169  ~Renderer();
170 
178  Renderer& operator = (const Renderer& other);
186  bool operator == (const Renderer& other) const;
194  bool operator != (const Renderer& other) const;
195 
203  bool IsEmpty() const;
204 
228  Progressive StartQuickRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
229 
260  Progressive StartRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
261 #ifndef __EMSCRIPTEN_RENDER__
262 
280  Progressive StartRenderReflowPage(const pdf::ReflowPage& reflow_page, const Matrix& matrix,
281  PauseCallback* pause = NULL);
282 
283 #ifndef _FX_NO_XFA_
284 
304  Progressive StartRenderXFAPage(const addon::xfa::XFAPage& xfa_page_view, const Matrix& matrix, bool is_highlight,
305  PauseCallback* pause = NULL);
306 #endif // #ifndef _FX_NO_XFA_
307 #endif
308 
333  Progressive StartRenderBitmap(const Bitmap& bitmap, const Matrix& matrix,
334  const RectI* clip_rect = NULL, uint32 interpolation = 0,
335  PauseCallback* pause = NULL);
336 #ifndef __EMSCRIPTEN_RENDER__
337 
346 
360  bool RenderAnnot(const pdf::annots::Annot& annot, const Matrix& matrix);
361 #endif
362 
374  bool RenderFormControls(const pdf::PDFPage& page, const Matrix& matrix);
375 #ifndef __EMSCRIPTEN_RENDER__
376 
389  bool RenderGraphicsObject(const pdf::graphics::GraphicsObject* graphics_object, const pdf::PDFPage& page, const Matrix& matrix);
390 #endif
391 
399  void SetClipRect(const RectI* clip_rect);
400 
411  void SetClipPathFill(const Path& clip_path, const Matrix& matrix, foxit::common::FillMode fill_mode);
412 
423  void SetClipPathStroke(const Path& clip_path, const Matrix& matrix, const GraphState* graph_state = NULL);
424 
437  void SetRenderContentFlags(uint32 render_content_flags);
438 
453  void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail);
454 
465  void SetRenderFormField(bool is_render_formfield);
466 
477  void SetRenderSignature(bool is_render_signature);
478 #ifndef __EMSCRIPTEN_RENDER__
479 
489  void SetLayerContext(const pdf::LayerContext& layer_context);
490 #endif
491 
514  void SetColorMode(ColorMode color_mode);
524  void SetMappingModeColors(ARGB background_color, ARGB foreground_color);
525 
536  void SetClearType(bool is_clear_type);
549  void SetPrintTextAsGraphic(bool is_to_print_text_graphic);
550 
561  void SetPrintTextAsImage(bool is_to_print_text_image);
562 
573  void SetForceDownSample(bool is_to_force_down_sample);
574 
588  void SetJPEGDownSample(bool is_jepg_down_sample);
589 
603  void SetJPXDownSample(bool is_jpx_down_sample);
604 
617  void EnableForPrint(bool is_render_for_print);
618 
629  void SetForceHalftone(bool is_to_force_halftone);
630 
641  void SetRenderPathThinLine(bool is_render_path_thin_line);
642 
653  void SetRenderTextAntiAliasing(bool is_render_text_antialiasing);
654 
665  void SetRenderPathAntiAliasing(bool is_render_path_antialiasing);
666 
676  void SetRenderPathFullCovered(bool is_render_path_full_covered);
677 
689  void SetRenderImageAntiAliasing(bool is_render_image_antialiasing);
690 
702  void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines);
703 
704  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
705  explicit Renderer(FS_HANDLE handle = NULL);
706 };
707 } // namespace common
708 } // namespace foxit
709 #endif // FS_RENDER_H_
710 
Definition: fs_pdfgraphicsobject.h:241
void SetRenderContentFlags(uint32 render_content_flags)
Set rendering flag to decide what content will be rendered.
Header file for PDF reflow page related definitions and classes.
Progressive StartRenderBitmap(const Bitmap &bitmap, const Matrix &matrix, const RectI *clip_rect=0, uint32 interpolation=0, PauseCallback *pause=0)
Start to render a bitmap.
Definition: fs_reflowpage.h:62
void SetRenderAnnotAppearanceType(foxit::pdf::annots::Annot::AppearanceType ap_type)
Set the annotation's appearance type for rendering.
Renderer & operator=(const Renderer &other)
Assign operator.
IFX_Pause PauseCallback
Definition: fs_common.h:1103
void SetJPXDownSample(bool is_jpx_down_sample)
Set the flag to decide whether to use down-sampling for jpx image.
void SetRenderImageAntiAliasing(bool is_render_image_antialiasing)
Set the flag to decide whether to draw image anti-aliasing.
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_xfa.h:1236
void EnableForPrint(bool is_render_for_print)
Set the flag to decide whether to do rendering in print mode.
void SetClipRect(const RectI *clip_rect)
Set the clipping rectangle which will be used in following rendering progress.
If set, page content will be rendered.
Definition: fs_render.h:93
void SetRenderPathAntiAliasing(bool is_render_path_antialiasing)
Set the flag to decide whether to draw path anti-aliasing.
ColorMode
Enumeration for rendering color mode.
Definition: fs_render.h:77
bool IsEmpty() const
Check whether current object is empty or not.
Progressive StartRenderXFAPage(const addon::xfa::XFAPage &xfa_page_view, const Matrix &matrix, bool is_highlight, PauseCallback *pause=0)
Start to render an XFA page.
void SetRenderTextAntiAliasing(bool is_render_text_antialiasing)
Set the flag to decide whether to draw text anti-aliasing.
void SetForceHalftone(bool is_to_force_halftone)
Set the flag to decide whether to use halftone for image stretching.
void SetJPEGDownSample(bool is_jepg_down_sample)
Set the flag to decide whether to use down-sampling for jpeg image.
Header file for PDF layer related definitions and classes.
Header file for image and bitmap related definitions and classes.
Map gray/white/black color value to background/foreground; for other colors, no change.
Definition: fs_render.h:81
void SetColorMode(ColorMode color_mode)
Set color mode.
Definition: fs_render.h:70
void SetRenderPathFullCovered(bool is_render_path_full_covered)
A special flag that can be applied to fill mode.
void SetClipPathFill(const Path &clip_path, const Matrix &matrix, foxit::common::FillMode fill_mode)
Set clipping path using filled region.
uint32 ARGB
ARGB color type, 32 bits, ((b) | ((g) << 8) | ((r) << 16)) | ((a) << 24)
Definition: fs_basictypes.h:210
Progressive StartRenderReflowPage(const pdf::ReflowPage &reflow_page, const Matrix &matrix, PauseCallback *pause=0)
Start to render a reflow page.
void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail)
Set rendering flag to decide whether to render annotations in thumbnail mode or not.
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 annotation related definitions and classes.
FillMode
Enumeration for filling mode type, mainly for path graphics object.
Definition: fs_common.h:89
Renderer(const Bitmap &bitmap, bool is_rgb_order)
Constructor, with bitmap.
void SetRenderPathThinLine(bool is_render_path_thin_line)
Set the flag to decide whether to draw path as thin line.
void SetRenderFormField(bool is_render_formfield)
Set the flag to decide whether to render form fields (except signature fields).
Map a color value to the color range defined by a background color and a foreground color.
Definition: fs_render.h:83
If set, annotations will be rendered.
Definition: fs_render.h:95
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:196
Definition: fs_pdfpage.h:411
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:214
Header file for common definitions and classes.
Progressive StartRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
Start to render a PDF page.
Normal color mode.
Definition: fs_render.h:79
bool operator !=(const Renderer &other) const
Not equal operator.
Definition: fx_coordinates.h:596
Definition: fs_basictypes.h:407
Definition: fs_pdflayer.h:323
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.
void SetForceDownSample(bool is_to_force_down_sample)
Set the flag to decide whether to use down-sampling for image stretching.
Header file for XFA related definitions and functions.
bool RenderAnnot(const pdf::annots::Annot &annot, const Matrix &matrix)
Render a specified annotation.
Definition: fs_annot.h:964
void SetRenderSignature(bool is_render_signature)
Set the flag to decide whether to render signatures or not.
Foxit namespace.
Definition: fs_taggedpdf.h:27
AppearanceType
Enumeration for the type of annotation's appearance.
Definition: fs_annot.h:1246
void SetPrintTextAsImage(bool is_to_print_text_image)
Set the flag to decide whether to print text as image.
ContentFlag
Enumeration for rendering content flags.
Definition: fs_render.h:91
void SetMappingModeColors(ARGB background_color, ARGB foreground_color)
Set background color and foreground color when color mode is Renderer::e_ColorModeMappingGray or Rend...
#define NULL
The null-pointer value.
Definition: fx_system.h:780
bool operator==(const Renderer &other) const
Equal operator.
Definition: fx_coordinates.h:1076
void SetPrintTextAsGraphic(bool is_to_print_text_graphic)
Set the flag to decide whether to print text as path or bitmap.
bool RenderFormControls(const pdf::PDFPage &page, const Matrix &matrix)
Render form controls.
void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines)
Set the flag to decide whether to enhance thin lines.
void SetClipPathStroke(const Path &clip_path, const Matrix &matrix, const GraphState *graph_state=0)
Set clipping path using stroked region.