Renderer

Definitions for a rendering engine.
Definitions and functions in this module are included in fs_renderer_r.h.
Module: Renderer
License Identifier: Renderer/All
Available License Right: Unnecessary. More...

Modules

 Renderers For Apple
 Definitions for a rendering engine on Apple.
Definitions and functions in this module are included in fs_renderer_apple_r.h.
Module: Renderer
License Identifier: Renderer/All
Available License Right: Unnecessary.
 
 Renderer For Windows
 Definitions for a rendering engine on windows.
Definitions and functions in this module are included in fs_renderer_windows_r.h.
Module: Renderer
License Identifier: Renderer/All
Available License Right: Unnecessary.
 

Classes

struct  FSCRT_RENDERER
 Handle type for a renderer. More...
 

Functions

FS_RESULT FSCRT_Renderer_CreateOnBitmap (FSCRT_BITMAP bitmap, FSCRT_RENDERER *renderer)
 Create a renderer on a bitmap object. More...
 
FS_RESULT FSCRT_Renderer_Release (FSCRT_RENDERER renderer)
 Release a given renderer object. More...
 
FS_RESULT FSCRT_Renderer_SetFlags (FSCRT_RENDERER renderer, FS_DWORD flags)
 Set flags of a renderer. More...
 
FS_RESULT FSCRT_Renderer_SetDitherBits (FSCRT_RENDERER renderer, FS_INT32 bits)
 Set bitmap dither bits of a renderer, support for 8bpp bitmap device. More...
 
FS_RESULT FSCRT_Renderer_SetGamma (FS_FLOAT gamma)
 Set gamma value for text rendering. More...
 
FS_RESULT FSCRT_Renderer_SetClipRect (FSCRT_RENDERER renderer, const FSCRT_RECT *clipRect)
 Set the current clipping rectangle into a renderer. More...
 
FS_RESULT FSCRT_Renderer_DrawBitmap (FSCRT_RENDERER renderer, FS_INT32 dstLeft, FS_INT32 dstTop, FSCRT_BITMAP srcBitmap, const FSCRT_RECT *srcRect)
 Render a bitmap object. More...
 

Macros Definitions for renderer flags

Note
Pass one or a combination of following flags to the function FSCRT_Renderer_SetFlags.
#define FSCRT_RENDERERFLAG_LCDTEXT   0x01
 Set if it needs text rendering optimization for LCD display.
 
#define FSCRT_RENDERERFLAG_BGRSTRIPE   0x02
 Set if device is using BGR LCD stripe.
 
#define FSCRT_RENDERERFLAG_USEANTIALIAS   0x04
 Use anti-aliasing to render graphics objects.
 
#define FSCRT_RENDERERFLAG_GRAYSCALE   0x08
 Gray scale output.
 
#define FSCRT_RENDERERFLAG_NONATIVETEXT   0x10
 Disable native text rendering feature (like GDI+, CGContext).
 
#define FSCRT_RENDERERFLAG_TEXTGAMMA   0x20
 Enable gamma to support to display small characters.
 

Macros Definitions for render blend mode

#define FSCRT_RENDERERBLEND_NORMAL   0
 Selecting source color and ignoring backdrop color. More...
 
#define FSCRT_RENDERERBLEND_MULTIPLY   1
 Multiply backdrop by source color values. More...
 
#define FSCRT_RENDERERBLEND_SCREEN   2
 Multiply complements of backdrop by source color values, and then complement the result. More...
 
#define FSCRT_RENDERERBLEND_OVERLAY   3
 Multiply or screens colors, depending on backdrop color value. More...
 
#define FSCRT_RENDERERBLEND_DARKEN   4
 Select darker one of backdrop and source colors. More...
 
#define FSCRT_RENDERERBLEND_LIGHTEN   5
 Select lighter one of backdrop and source colors. More...
 
#define FSCRT_RENDERERBLEND_COLORDODGE   6
 Brightens backdrop color to reflect source colors. More...
 
#define FSCRT_RENDERERBLEND_COLORBURN   7
 Darkens backdrop color to reflect the source color. More...
 
#define FSCRT_RENDERERBLEND_HARDLIGHT   8
 Multiply or screens colors, depending on source color value. More...
 
#define FSCRT_RENDERERBLEND_SOFTLIGHT   9
 Darkens or lightens colors, depending on source color value. More...
 
#define FSCRT_RENDERERBLEND_DIFFERENCE   10
 Subtracts the darker of the two constituent colors from lighter colors. More...
 
#define FSCRT_RENDERERBLEND_EXCLUSION   11
 Produces an effect similar to that of different modes but lower in contrast. More...
 
#define FSCRT_RENDERERBLEND_HUE   21
 Creates a color with the hue of the source color, and the saturation and luminosity of the backdrop color. More...
 
#define FSCRT_RENDERERBLEND_SATURATION   22
 Creates a color with the saturation of the source color, and the hue and luminosity of the backdrop color. More...
 
#define FSCRT_RENDERERBLEND_COLOR   23
 Creates a color with the hue and saturation of the source color, and the luminosity of the backdrop color. More...
 
#define FSCRT_RENDERERBLEND_LUMINOSITY   24
 Creates a color with the luminosity of the source color, and the hue and saturation of the backdrop color. More...
 

Macro Definitions for Line Cap Styles

#define FSCRT_LINECAP_BUTT   0
 The Butt Line Cap Type. More...
 
#define FSCRT_LINECAP_ROUND   1
 The Round Line Cap Type. More...
 
#define FSCRT_LINECAP_SQUARE   2
 The Projecting Square Line Cap Type. More...
 

Macro Definitions for Line Join Styles

#define FSCRT_LINEJOIN_MITER   0
 Miter line join type. More...
 
#define FSCRT_LINEJOIN_ROUND   1
 Round line join type. More...
 
#define FSCRT_LINEJOIN_BEVEL   2
 Bevel line join type. More...
 

Detailed Description

Definitions for a rendering engine.
Definitions and functions in this module are included in fs_renderer_r.h.
Module: Renderer
License Identifier: Renderer/All
Available License Right: Unnecessary.

This module contains the following features:

Macro Definition Documentation

#define FSCRT_LINECAP_BUTT   0

The Butt Line Cap Type.

The stroke is squared off at the endpoint of a path. There is no projection beyond the end of a path.

#define FSCRT_LINECAP_ROUND   1

The Round Line Cap Type.

A semicircular arc with a diameter equal to the line width is drawn around the endpoint and filled in.

#define FSCRT_LINECAP_SQUARE   2

The Projecting Square Line Cap Type.

The stroke continues beyond the endpoint of the path for a distance equal to half the line width and is squared off.

#define FSCRT_LINEJOIN_BEVEL   2

Bevel line join type.

The two segments are finished with butt caps and the resulting notch beyond the end of the segments is filled with a triangle.

#define FSCRT_LINEJOIN_MITER   0

Miter line join type.

The outer edges of the strokes for the two segments are extended until they meet at an angle.

#define FSCRT_LINEJOIN_ROUND   1

Round line join type.

An arc of a circle with a diameter equal to the line width is drawn around the point where the two segments meet, connecting the outer edges of the strokes for the two segments.

#define FSCRT_RENDERERBLEND_COLOR   23

Creates a color with the hue and saturation of the source color, and the luminosity of the backdrop color.

Here is the formula :
B(Cb, Cs) = SetLum(Cs, Lum(Cb)).

#define FSCRT_RENDERERBLEND_COLORBURN   7

Darkens backdrop color to reflect the source color.

Painting with white produces no changes.
Here is the formula :
B(Cb, Cs) =

  • 1 - min(1, (1 - Cb) / Cs) if Cs > 0
  • 0 if Cs = 0
#define FSCRT_RENDERERBLEND_COLORDODGE   6

Brightens backdrop color to reflect source colors.

Painting with black produces no changes.
Here is the formula :
B(Cb, Cs) =

  • min(1, Cb / (1 - Cs)) if Cs < 1
  • 1 if Cs = 1
#define FSCRT_RENDERERBLEND_DARKEN   4

Select darker one of backdrop and source colors.

Here is the formula :
B(Cb, Cs) = min(Cb, Cs).

#define FSCRT_RENDERERBLEND_DIFFERENCE   10

Subtracts the darker of the two constituent colors from lighter colors.

Here is the formula :
B(Cb, Cs) = |Cb - Cs|.

#define FSCRT_RENDERERBLEND_EXCLUSION   11

Produces an effect similar to that of different modes but lower in contrast.

Here is the formula :
B(Cb, Cs) = Cb + Cs - 2 * Cb * Cs.

#define FSCRT_RENDERERBLEND_HARDLIGHT   8

Multiply or screens colors, depending on source color value.

Here is the formula :
B(Cb, Cs) =

  • Multiply(Cb, 2 * Cs) if Cs <= 0.5
  • Screen(Cb, 2 * Cs - 1) if Cs > 0.5
#define FSCRT_RENDERERBLEND_HUE   21

Creates a color with the hue of the source color, and the saturation and luminosity of the backdrop color.

Here is the formula :
B(Cb, Cs) = SetLum(SetSat(Cs, Sat(Cb)), Lum(Cb)).

#define FSCRT_RENDERERBLEND_LIGHTEN   5

Select lighter one of backdrop and source colors.

Here is the formula :
B(Cb, Cs) = max(Cb, Cs).

#define FSCRT_RENDERERBLEND_LUMINOSITY   24

Creates a color with the luminosity of the source color, and the hue and saturation of the backdrop color.

Here is the formula :
B(Cb, Cs) = SetLum(Cb, Lum(Cs)).

#define FSCRT_RENDERERBLEND_MULTIPLY   1

Multiply backdrop by source color values.

Here is the formula :
B(Cb, Cs) = Cb * Cs.

#define FSCRT_RENDERERBLEND_NORMAL   0

Selecting source color and ignoring backdrop color.

Here is the formula :
B(Cb, Cs) = Cs.

#define FSCRT_RENDERERBLEND_OVERLAY   3

Multiply or screens colors, depending on backdrop color value.

Here is the formula :
B(Cb, Cs) = HardLight(Cs, Cb).

#define FSCRT_RENDERERBLEND_SATURATION   22

Creates a color with the saturation of the source color, and the hue and luminosity of the backdrop color.

Here is the formula :
B(Cb, Cs) = SetLum(SetSat(Cb, Sat(Cs)), Lum(Cb)).

#define FSCRT_RENDERERBLEND_SCREEN   2

Multiply complements of backdrop by source color values, and then complement the result.

Here is the formula :
B(Cb, Cs) = 1 - [(1 - Cb) * (1 - Cs)] = Cb + Cs - Cb * Cs.

#define FSCRT_RENDERERBLEND_SOFTLIGHT   9

Darkens or lightens colors, depending on source color value.

Here is the formula :
B(Cb, Cs) =

  • Cb - (1 - 2 * Cs) * Cb * (1 - Cb) if Cs <= 0.5
  • Cb + (2 * Cs - 1) * (D(Cb) - Cb) if Cs > 0.5
    where D(x) =
  • ((16 * x - 12) * x + 4) * x if x <= 0.25
  • sqrt(x) if x > 0.25

Function Documentation

FS_RESULT FSCRT_Renderer_CreateOnBitmap ( FSCRT_BITMAP  bitmap,
FSCRT_RENDERER *  renderer 
)

Create a renderer on a bitmap object.

Renderer is a term of graphics engine in Foxit PDF SDK. It provides basic management and drawing operations as a common feature.
There are two approaches to use a renderer: one is to draw on a renderer directly, and the other one is to output document contents by using a graphics context.
PDF module provides a rendering context to output page contents. Please refer to function FSPDF_RenderContext_Create.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object used to create a renderer.
ATTENTION: FSCRT_BITMAPFORMAT_16BPP_RGB565 is only supported in Android Platform.
[out]rendererPointer to a FSCRT_RENDERER handle that receives a new renderer.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap or renderer is NULL.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
FSCRT_ERRCODE_ERROR if fail to create renderer on the specified parameter bitmap.
FSCRT_ERRCODE_UNSUPPORTED if the format of parameter bitmap is FSCRT_BITMAPFORMAT_1BPP_RGB, FSCRT_BITMAPFORMAT_8BPP_MASK or the format of parameter bitmap is FSCRT_BITMAPFORMAT_16BPP_RGB565 but used in non-Android Platform.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • bitmap: this handle is long-term recoverable.
  • renderer: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Renderer_DrawBitmap ( FSCRT_RENDERER  renderer,
FS_INT32  dstLeft,
FS_INT32  dstTop,
FSCRT_BITMAP  srcBitmap,
const FSCRT_RECT srcRect 
)

Render a bitmap object.

Parameters
[in]rendererHandle to a FSCRT_RENDERER object which is a renderer object.
[in]dstLeftLeft pixel position of a given area to render in the coordinate of destination.
[in]dstTopTop pixel position of a given area to render in the coordinate of destination.
[in]srcBitmapHandle to a FSCRT_BITMAP object which is a bitmap object used to render.
[in]srcRectPointer to a FSCRT_RECT structure which specifies a rectangle of the bitmap.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter renderer or parameter srcBitmap or parameter srcRect is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the bitmap format is one of these formats:FSCRT_BITMAPFORMAT_16BPP_RGB565, FSCRT_BITMAPFORMAT_24BPP_RGB, FSCRT_BITMAPFORMAT_32BPP_RGBx, FSCRT_BITMAPFORMAT_32BPP_RGBA.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • renderer: this handle is long-term recoverable.
  • srcBitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Renderer_Release ( FSCRT_RENDERER  renderer)

Release a given renderer object.

Parameters
[in]rendererHandle to a FSCRT_RENDERER object which is a renderer object created by the function FSCRT_Renderer_CreateOnBitmap or platform-dependednt renderer creating functions.
Returns
FSCRT_ERRCODE_SUCCESS if the current process finishes successfully.
FSCRT_ERRCODE_PARAM if the parameter renderer is NULL.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Applications need to make sure thread safety by themselves when accessing the same objects during multi-thread environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • renderer: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Renderer_SetClipRect ( FSCRT_RENDERER  renderer,
const FSCRT_RECT clipRect 
)

Set the current clipping rectangle into a renderer.

Parameters
[in]rendererHandle to a FSCRT_RENDERER object which is a renderer object.
[in]clipRectPointer to a FSCRT_RECT structure which specifies a clipping rectangle. Set it to NULL if clear the current clipping region.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter renderer is NULL.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • renderer: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Renderer_SetDitherBits ( FSCRT_RENDERER  renderer,
FS_INT32  bits 
)

Set bitmap dither bits of a renderer, support for 8bpp bitmap device.

Parameters
[in]rendererHandle to a FSCRT_RENDERER object which is a renderer object.
[in]bitsAn integer value for number of bitmap dither bits. The valid values are 2,3,4.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter renderer is NULL.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This function only support for mobile platforms, not for desktop platforms.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • renderer: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Renderer_SetFlags ( FSCRT_RENDERER  renderer,
FS_DWORD  flags 
)

Set flags of a renderer.

Parameters
[in]rendererHandle to a FSCRT_RENDERER object which is a renderer object.
[in]flagsAn integer value for renderer flags. All undefined bits are omitted.
Please refer to macro definitions FSCRT_RENDERERFLAG_XXX and this can be one or a combination of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter renderer is NULL.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • renderer: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Renderer_SetGamma ( FS_FLOAT  gamma)

Set gamma value for text rendering.

Parameters
[in]gammaGamma value. It should be greater than 0. The default value is 2.2.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter gamma is invalid.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.

Foxit Corporation