Public Member Functions | |
Renderer (android.graphics.Bitmap bitmap, boolean is_rgb_order) throws com.foxit.sdk.PDFException | |
Constructor, with bitmap. More... | |
Renderer (Renderer other) | |
Constructor, with another renderer object. More... | |
boolean | isEmpty () |
Check whether current object is empty or not. More... | |
boolean | renderAnnot (Annot annot, Matrix2D matrix) throws com.foxit.sdk.PDFException |
Render a specified annotation. More... | |
boolean | renderGraphicsObject (GraphicsObject graphics_object, PDFPage page, Matrix2D matrix) throws com.foxit.sdk.PDFException |
Render a graphics object. More... | |
void | setClipPathFill (Path clip_path, Matrix2D matrix, int fill_mode) throws com.foxit.sdk.PDFException |
Set clipping path using filled region. More... | |
void | setClipPathStroke (Path clip_path, Matrix2D matrix, GraphState graph_state) throws com.foxit.sdk.PDFException |
Set clipping path using stroked region. More... | |
void | setClipRect (RectI clip_rect) throws com.foxit.sdk.PDFException |
Set the clipping rectangle which will be used in following rendering progress. More... | |
void | setColorMode (int color_mode) throws com.foxit.sdk.PDFException |
Set color mode. More... | |
void | setForceHalftone (boolean is_to_force_halftone) throws com.foxit.sdk.PDFException |
Set the flag to decide whether to use halftone for image stretching. More... | |
void | setLayerContext (LayerContext layer_context) throws com.foxit.sdk.PDFException |
Set layer context to render context handle. More... | |
void | setMappingModeColors (int background_color, int foreground_color) throws com.foxit.sdk.PDFException |
Set background color and foreground color when color mode is com.foxit.sdk.common.Renderer.e_ColorModeMapping . More... | |
void | setRenderContentFlags (int render_content_flags) throws com.foxit.sdk.PDFException |
Set rendering flag to decide what content will be rendered. More... | |
void | setRenderFormField (boolean is_render_formfield) throws com.foxit.sdk.PDFException |
Set the flag to decide whether to render form fields (except signature fields). More... | |
void | setRenderImageAntiAliasing (boolean is_render_image_antialiasing) throws com.foxit.sdk.PDFException |
Set the flag to decide whether to draw image anti-aliasing. More... | |
void | setRenderPathAntiAliasing (boolean is_render_path_antialiasing) throws com.foxit.sdk.PDFException |
Set the flag to decide whether to draw path anti-aliasing. More... | |
void | setRenderPathThinLine (boolean is_render_path_thin_line) throws com.foxit.sdk.PDFException |
Set the flag to decide whether to draw path as thin line. More... | |
void | setRenderSignature (boolean is_render_signature) throws com.foxit.sdk.PDFException |
Set the flag to decide whether to render signatures or not. More... | |
void | setRenderTextAntiAliasing (boolean is_render_text_antialiasing) throws com.foxit.sdk.PDFException |
Set the flag to decide whether to draw text anti-aliasing. More... | |
Progressive | startQuickRender (PDFPage page, Matrix2D matrix, PauseCallback pause) throws com.foxit.sdk.PDFException |
Start to quickly render a PDF page, mainly for thumbnail purpose. More... | |
Progressive | startRender (PDFPage page, Matrix2D matrix, PauseCallback pause) throws com.foxit.sdk.PDFException |
Start to render a PDF page. More... | |
Progressive | startRenderBitmap (android.graphics.Bitmap bitmap, Matrix2D matrix, RectI clip_rect, int interpolation, PauseCallback pause) throws com.foxit.sdk.PDFException |
Start to render a bitmap. More... | |
Progressive | startRenderReflowPage (ReflowPage reflow_page, Matrix2D matrix, PauseCallback pause) throws com.foxit.sdk.PDFException |
Start to render a reflow page. More... | |
Progressive | startRenderXFAPage (XFAPage xfa_page_view, Matrix2D matrix, boolean is_highlight, PauseCallback pause) throws com.foxit.sdk.PDFException |
Start to render an XFA page. More... | |
Static Public Attributes | |
static final int | e_ColorModeMapping = 2 |
Map a color value to the color range defined by a background color and a foreground color. | |
static final int | e_ColorModeNormal = 0 |
Normal color mode. | |
static final int | e_RenderAnnot = 0x02 |
If set, annotations will be rendered. | |
static final int | e_RenderPage = 0x01 |
If set, page content will be rendered. | |
PDF renderer is a graphics engine and is used to render page to a bitmap or a platform device context. This class can be constructed with a bitmap, or a device object. It offers functions to set rendering options/flags, and do rendering. In this class, there are several ways to do rendering:
Widget annotation is always associated with form field and form control in Foxit PDF SDK. For how to render widget annotations, here is a recommended flow:
com.foxit.sdk.common.Renderer.Renderer | ( | android.graphics.Bitmap | bitmap, |
boolean | is_rgb_order | ||
) | throws com.foxit.sdk.PDFException |
Constructor, with bitmap.
The input bitmap is treated as an independent device and all the content rendered by the renderer would appear in the bitmap.
[in] | bitmap | A bitmap used for rendering. User should ensure the bitmap to keep valid until the end of life cycle of current renderer object. |
[in] | is_rgb_order | true means Foxit PDF SDK needs to use RGB byte-order (Red is in the lowest order) when rendering. false means Foxit PDF SDK needs to use BGR byte-order (Blue is in the lowest order) when rendering. |
com.foxit.sdk.common.Renderer.Renderer | ( | Renderer | other | ) |
Constructor, with another renderer object.
[in] | other | Another renderer object. |
boolean com.foxit.sdk.common.Renderer.isEmpty | ( | ) |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
boolean com.foxit.sdk.common.Renderer.renderAnnot | ( | Annot | annot, |
Matrix2D | matrix | ||
) | throws com.foxit.sdk.PDFException |
Render a specified annotation.
When this function is called, rendering flag (set by function Renderer.setRenderContentFlags or by default) will be ignored.
[in] | annot | An annotation object to be rendered. If input annot is a pop-up annotation, this function will not render it and will return false. |
[in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf.PDFPage.getDisplayMatrix . |
boolean com.foxit.sdk.common.Renderer.renderGraphicsObject | ( | GraphicsObject | graphics_object, |
PDFPage | page, | ||
Matrix2D | matrix | ||
) | throws com.foxit.sdk.PDFException |
Render a graphics object.
When this function is called, rendering flag (set by function Renderer.setRenderContentFlags or by default) will be ignored.
[in] | graphics_object | A valid PDF graphics object to be rendered. |
[in] | page | A valid PDF page. Parameter graphics_object belongs to this PDF page. |
[in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf.PDFPage.getDisplayMatrix . |
void com.foxit.sdk.common.Renderer.setClipPathFill | ( | Path | clip_path, |
Matrix2D | matrix, | ||
int | fill_mode | ||
) | throws com.foxit.sdk.PDFException |
Set clipping path using filled region.
[in] | clip_path | A clipping path. |
[in] | matrix | The transformation matrix used for clipping. |
[in] | fill_mode | Fill mode. It should be value or . |
void com.foxit.sdk.common.Renderer.setClipPathStroke | ( | Path | clip_path, |
Matrix2D | matrix, | ||
GraphState | graph_state | ||
) | throws com.foxit.sdk.PDFException |
Set clipping path using stroked region.
[in] | clip_path | A clipping path. |
[in] | matrix | The transformation matrix used for clipping. |
[in] | graph_state | New graph state, for pen attributes. It can be NULL. Default value: NULL. |
void com.foxit.sdk.common.Renderer.setClipRect | ( | RectI | clip_rect | ) | throws com.foxit.sdk.PDFException |
Set the clipping rectangle which will be used in following rendering progress.
[in] | clip_rect | A clipping rectangle. If it is NULL, that means not to use clipping rectangle in following rendering progress. |
void com.foxit.sdk.common.Renderer.setColorMode | ( | int | color_mode | ) | throws com.foxit.sdk.PDFException |
Set color mode.
If this function is not called, default value com.foxit.sdk.common.Renderer.e_ColorModeNormal will be used.
[in] | color_mode | Color mode value. It should be one of following values:
|
void com.foxit.sdk.common.Renderer.setForceHalftone | ( | boolean | is_to_force_halftone | ) | throws com.foxit.sdk.PDFException |
Set the flag to decide whether to use halftone for image stretching.
If this function is not called, default value true will be used.
[in] | is_to_force_halftone | true means to use halftone for image stretching. false means not to use halftone for image stretching. |
void com.foxit.sdk.common.Renderer.setLayerContext | ( | LayerContext | layer_context | ) | throws com.foxit.sdk.PDFException |
Set layer context to render context handle.
In order to render one layer when PDF page's contents is rendered on a rendering context, user should call this function to set the layer context to render context.
[in] | layer_context | A layer context object. |
void com.foxit.sdk.common.Renderer.setMappingModeColors | ( | int | background_color, |
int | foreground_color | ||
) | throws com.foxit.sdk.PDFException |
Set background color and foreground color when color mode is com.foxit.sdk.common.Renderer.e_ColorModeMapping .
[in] | background_color | The background color. Format: 0xAARRGGBB. |
[in] | foreground_color | The foreground color. Format: 0xAARRGGBB. |
void com.foxit.sdk.common.Renderer.setRenderContentFlags | ( | int | render_content_flags | ) | throws com.foxit.sdk.PDFException |
Set rendering flag to decide what content will be rendered.
If this function is not called, default value (com.foxit.sdk.common.Renderer.e_RenderPage | com.foxit.sdk.common.Renderer.e_RenderAnnot ) will be used.
[in] | render_content_flags | Rendering content flags. Please refer to values starting from com.foxit.sdk.common.Renderer.e_RenderPage and this should be one or a combination of these values. |
void com.foxit.sdk.common.Renderer.setRenderFormField | ( | boolean | is_render_formfield | ) | throws com.foxit.sdk.PDFException |
Set the flag to decide whether to render form fields (except signature fields).
If this function is not called, default value true will be used.
[in] | is_render_formfield | true means to render form fields (except signature fields). false means not to render form fields (except signature fields). Default value: true. |
void com.foxit.sdk.common.Renderer.setRenderImageAntiAliasing | ( | boolean | is_render_image_antialiasing | ) | throws com.foxit.sdk.PDFException |
Set the flag to decide whether to draw image anti-aliasing.
If this function is not called, default value true will be used.
[in] | is_render_image_antialiasing | true means to draw image anti-aliasing, and the effect would be similar to values defined in enum class InterpolationFlag. false means to draw image aliasing. |
void com.foxit.sdk.common.Renderer.setRenderPathAntiAliasing | ( | boolean | is_render_path_antialiasing | ) | throws com.foxit.sdk.PDFException |
Set the flag to decide whether to draw path anti-aliasing.
If this function is not called, default value true will be used.
[in] | is_render_path_antialiasing | true means to draw path anti-aliasing. false means to draw path aliasing. |
void com.foxit.sdk.common.Renderer.setRenderPathThinLine | ( | boolean | is_render_path_thin_line | ) | throws com.foxit.sdk.PDFException |
Set the flag to decide whether to draw path as thin line.
If this function is not called, default value false will be used.
[in] | is_render_path_thin_line | true means to draw path as thin line. false means not to draw path as thin line. |
void com.foxit.sdk.common.Renderer.setRenderSignature | ( | boolean | is_render_signature | ) | throws com.foxit.sdk.PDFException |
Set the flag to decide whether to render signatures or not.
If this function is not called, default value true will be used.
[in] | is_render_signature | true means to render signatures. false means not to render signatures. |
void com.foxit.sdk.common.Renderer.setRenderTextAntiAliasing | ( | boolean | is_render_text_antialiasing | ) | throws com.foxit.sdk.PDFException |
Set the flag to decide whether to draw text anti-aliasing.
If this function is not called, default value true will be used.
[in] | is_render_text_antialiasing | true means to draw text anti-aliasing. false means to draw text aliasing. |
Progressive com.foxit.sdk.common.Renderer.startQuickRender | ( | PDFPage | page, |
Matrix2D | matrix, | ||
PauseCallback | pause | ||
) | throws com.foxit.sdk.PDFException |
Start to quickly render a PDF page, mainly for thumbnail purpose.
This function is mainly used for render a page for thumbnail purpose. The rendered content will not be completed: all the annotations will be ignored, event if flag com.foxit.sdk.common.Renderer.e_RenderAnnot is set by function Renderer.setRenderContentFlags ; text content will become blurred and will be replace by pixel point.
It may still take a long time to do this quick rendering when page has complex or large contents, so Foxit PDF SDK uses a progressive process to do this.
[in] | page | A valid PDF page. It should have been parsed. |
[in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf.PDFPage.getDisplayMatrix . |
[in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL. |
Progressive com.foxit.sdk.common.Renderer.startRender | ( | PDFPage | page, |
Matrix2D | matrix, | ||
PauseCallback | pause | ||
) | throws com.foxit.sdk.PDFException |
Start to render a PDF page.
It may take a long time to render a PDF page with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.
Widget annotation is always associated with form field and form control in Foxit PDF SDK. For how to render widget annotations, here is a recommended flow:
[in] | page | A valid PDF page. If only to render annotations (that means only com.foxit.sdk.common.Renderer.e_RenderAnnot is set by function Renderer.setRenderContentFlags ), there is no need to parse the input page; otherwise the input page should have been parsed. |
[in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf.PDFPage.getDisplayMatrix . |
[in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL. |
Progressive com.foxit.sdk.common.Renderer.startRenderBitmap | ( | android.graphics.Bitmap | bitmap, |
Matrix2D | matrix, | ||
RectI | clip_rect, | ||
int | interpolation, | ||
PauseCallback | pause | ||
) | throws com.foxit.sdk.PDFException |
Start to render a bitmap.
It may take a long time to render a bitmap with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.
[in] | bitmap | A valid bitmap. User should ensure the bitmap to keep valid until current rendering process is finished. |
[in] | matrix | The transformation matrix used for rendering. This matrix is used as image matrix: assume that h is image height, w is image width, and then matrix [w 0 0 h 0 0] will produce an identical image. |
[in] | clip_rect | Clip rectangle for the rendering device. This can be NULL. Default value: NULL. |
[in] | interpolation | Bitmap interpolation flags. Please refer to values starting from com.foxit.sdk.common.Bitmap.e_Downsample and this can be one or a combination of these values. If not specify any flag, please use 0. Default value: 0. |
[in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL. |
Progressive com.foxit.sdk.common.Renderer.startRenderReflowPage | ( | ReflowPage | reflow_page, |
Matrix2D | matrix, | ||
PauseCallback | pause | ||
) | throws com.foxit.sdk.PDFException |
Start to render a reflow page.
It may take a long time to render a reflow page with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.
[in] | reflow_page | A valid reflow page. It should have been parsed. |
[in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf.ReflowPage.getDisplayMatrix . |
[in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value:NULL. |
Progressive com.foxit.sdk.common.Renderer.startRenderXFAPage | ( | XFAPage | xfa_page_view, |
Matrix2D | matrix, | ||
boolean | is_highlight, | ||
PauseCallback | pause | ||
) | throws com.foxit.sdk.PDFException |
Start to render an XFA page.
It will take a long time to render an XFA page with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.
[in] | xfa_page_view | A valid XFA page. |
[in] | matrix | The transformation matrix used for rendering, which is usually returned by function addon.xfa.XFAPage.getDisplayMatrix . |
[in] | is_highlight | true means to highlight XFA widgets, and false means not to highlight XFA widgets. |
[in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL. |