Image

Definitions for image functionality.
Definitions and functions in this module are included in fs_image_r.h and fs_image_w.h.
Module: Image
License Identifier: Image/All
Available License Right: Reading/Writing
For license Right Reading, see fs_image_r.h.
For license Right Writing, see fs_image_w.h. More...

Classes

struct  FSCRT_BITMAP
 Handle type to bitmap. More...
 
struct  FSCRT_BITMAPINFOHEADER
 Structure for information about dimensions and color format of a device-independent bitmap (DIB). More...
 
struct  FSCRT_RGBQUAD
 Structure for a color consisting of relative intensities of red, green, and blue. More...
 
struct  FSCRT_BITMAPINFO
 Structure for dimensions and color information of a device-independent bitmap(DIB). More...
 
struct  FSCRT_IMAGE
 Handle type to image. More...
 
struct  FSCRT_IMAGEFILE
 Handle type to image file. More...
 

Functions

FS_RESULT FSCRT_Bitmap_Create (FS_INT32 width, FS_INT32 height, FS_INT32 format, FS_LPVOID buffer, FS_INT32 stride, FSCRT_BITMAP *bitmap)
 Create a bitmap. More...
 
FS_RESULT FSCRT_Bitmap_Release (FSCRT_BITMAP bitmap)
 Destroy a bitmap and release related resources. More...
 
FS_RESULT FSCRT_Bitmap_FillRect (FSCRT_BITMAP bitmap, FS_ARGB color, const FSCRT_RECT *fillRect)
 Fill a bitmap object with a specified color. More...
 
FS_RESULT FSCRT_Bitmap_GetFormat (FSCRT_BITMAP bitmap, FS_INT32 *format)
 Get format of a bitmap object. More...
 
FS_RESULT FSCRT_Bitmap_GetSize (FSCRT_BITMAP bitmap, FS_INT32 *width, FS_INT32 *height)
 Get the size of a bitmap object. More...
 
FS_RESULT FSCRT_Bitmap_GetLineBuffer (FSCRT_BITMAP bitmap, FS_INT32 lineIndex, FS_LPVOID *buffer)
 Get a line buffer of a bitmap object. More...
 
FS_RESULT FSCRT_Bitmap_GetLineStride (FSCRT_BITMAP bitmap, FS_INT32 *stride)
 Get a row stride of the bitmap. More...
 
FS_RESULT FSCRT_Bitmap_GetFlipped (FSCRT_BITMAP srcBitmap, FS_BOOL flipX, FS_BOOL flipY, FSCRT_BITMAP *dstBitmap)
 Swap X/Y dimensions of a bitmap object to generate rotated one. More...
 
FS_RESULT FSCRT_Bitmap_StretchTo (FSCRT_BITMAP srcBitmap, FSCRT_BITMAP dstBitmap, FS_INT32 dstLeft, FS_INT32 dstTop, FS_INT32 dstWidth, FS_INT32 dstHeight, const FSCRT_RECT *dstClipRect, FS_INT32 interpolation)
 Stretch the source bitmap into a new bitmap with different size. More...
 
FS_RESULT FSCRT_Bitmap_TransformTo (FSCRT_BITMAP srcBitmap, FSCRT_BITMAP dstBitmap, const FSCRT_MATRIX *matrix, const FSCRT_RECT *dstClipRect, FS_INT32 interpolation)
 Transform a source bitmap into destination one. More...
 
FS_RESULT FSCRT_Bitmap_ConvertFormat (FSCRT_BITMAP bitmap, FS_INT32 format)
 Convert a bitmap to another specific format. More...
 
FS_RESULT FSCRT_Bitmap_Clone (FSCRT_BITMAP bitmap, FSCRT_BITMAP *clonedBitmap)
 Clone a bitmap. More...
 
FS_RESULT FSCRT_Bitmap_GetBitmapInfo (FSCRT_BITMAP bitmap, FSCRT_BITMAPINFO *bitmapInfo, FS_DWORD *size)
 Get bitmap information from a given Foxit DIB. More...
 
FS_RESULT FSCRT_Bitmap_CalcBBox (FSCRT_BITMAP bitmap, FS_INT32 flag, FS_ARGB backColor, FS_INT32 windowSize, FS_INT32 tolerance, FSCRT_RECT *rectBBox)
 Calculate the bounding box of a bitmap. More...
 
FS_RESULT FSCRT_Bitmap_GetMask (FSCRT_BITMAP bitmap, FSCRT_BITMAP *mask)
 Get the mask bitmap of a bitmap. More...
 
FS_RESULT FSCRT_Image_LoadFromFile (FSCRT_FILE imageFile, FSCRT_IMAGE *image)
 Load an image from an image file. More...
 
FS_RESULT FSCRT_Image_GetType (FSCRT_IMAGE image, FS_INT32 *type)
 Get an image type. More...
 
FS_RESULT FSCRT_Image_GetSize (FSCRT_IMAGE image, FS_INT32 *width, FS_INT32 *height)
 Get width and height of an image. More...
 
FS_RESULT FSCRT_Image_CountFrames (FSCRT_IMAGE image, FS_INT32 *count)
 Count frames of an image. More...
 
FS_RESULT FSCRT_Image_LoadFrame (FSCRT_IMAGE image, FS_INT32 frameIndex)
 Load an image frame by index. More...
 
FS_RESULT FSCRT_Image_GetCurrentFrameSize (FSCRT_IMAGE image, FS_INT32 *width, FS_INT32 *height)
 Get width and height of the current frame. More...
 
FS_RESULT FSCRT_Image_GetCurrentFrameBitmap (FSCRT_IMAGE image, FSCRT_BITMAP *bitmap)
 Retrieve the bitmap of the current frame. More...
 
FS_RESULT FSCRT_Image_GetProperty (FSCRT_IMAGE image, const FSCRT_BSTR *property, FSCRT_VAR *values, FS_INT32 *count)
 Get properties of an image. More...
 
FS_RESULT FSCRT_Image_Release (FSCRT_IMAGE image)
 Release an image object. More...
 
FS_RESULT FSCRT_ImageFile_Create (FSCRT_FILE file, FS_INT32 imageType, FS_INT32 frameCount, FSCRT_IMAGEFILE *imageFile)
 Create an image file. More...
 
FS_RESULT FSCRT_ImageFile_SetProperty (FSCRT_IMAGEFILE imageFile, const FSCRT_BSTR *property, const FSCRT_VAR *values, FS_INT32 count)
 Set properties of image. More...
 
FS_RESULT FSCRT_ImageFile_AddFrame (FSCRT_IMAGEFILE imageFile, FSCRT_BITMAP bitmap)
 Add a frame to image file. More...
 
FS_RESULT FSCRT_ImageFile_Release (FSCRT_IMAGEFILE imageFile)
 Release an image file object. More...
 

Macro Definitions for Bitmap Format

#define FSCRT_BITMAPFORMAT_24BPP_BGR   1
 24bpp format, bits order: Blue, Green, Red. Blue is the lowest order.
 
#define FSCRT_BITMAPFORMAT_32BPP_BGRx   2
 32bpp format, bits order: Blue, Green, Red, not used. Blue is the lowest order.
 
#define FSCRT_BITMAPFORMAT_32BPP_BGRA   3
 32bpp format, bits order: Blue, Green, Red, Alpha. Blue is the lowest order.
 
#define FSCRT_BITMAPFORMAT_8BPP_GRAY   4
 8bpp format, gray scale.
 
#define FSCRT_BITMAPFORMAT_24BPP_RGB   5
 24bpp format, bits order: Red, Green, Blue. Red is the lowest order.
 
#define FSCRT_BITMAPFORMAT_32BPP_RGBx   6
 32bpp format, bits order: Red, Green, Blue, not used. Red is the lowest order.
 
#define FSCRT_BITMAPFORMAT_32BPP_RGBA   7
 32bpp format, bits order: Red, Green, Blue, Alpha. Red is the lowest order.
 
#define FSCRT_BITMAPFORMAT_16BPP_RGB565   8
 16bpp format, bits order: Red 5 bits, Green 6 bits, Blue 5 bits. Red is the lowest order.
 
#define FSCRT_BITMAPFORMAT_8BPP_MASK   9
 8bpp alpha mask.
 
#define FSCRT_BITMAPFORMAT_1BPP_RGB   10
 1bpp format, 0 for black, 1 for white.
 

Macro Definitions for ARGB Color Format

#define FSCRT_ARGB_Encode(a, r, g, b)   ((((FS_DWORD)(((FS_BYTE)(b) | ((FS_DWORD)((FS_BYTE)(g)) << 8)) | (((FS_DWORD)(FS_BYTE)(r)) << 16)))) | (((FS_DWORD)(FS_BYTE)(a)) << 24))
 Used for encode ARGB color format.
 
#define FSCRT_ARGB_GetAValue(argb)   ((FS_BYTE)(((FS_DWORD)(argb)) >> 24))
 Used for get the A value from ARGB color format.
 
#define FSCRT_ARGB_GetRValue(argb)   ((FS_BYTE)(((FS_DWORD)(argb)) >> 16))
 Used for get the R value from ARGB color format.
 
#define FSCRT_ARGB_GetGValue(argb)   ((FS_BYTE)(((FS_DWORD)(argb)) >> 8))
 Used for get the G value from ARGB color format.
 
#define FSCRT_ARGB_GetBValue(argb)   ((FS_BYTE)(argb))
 Used for get the B value from ARGB color format.
 

Macro Definitions for stretching or transforming

#define FSCRT_INTERPOLATION_DOWNSAMPLE   0x04
 When set, do not do halftone for shrinking or rotating.
 
#define FSCRT_INTERPOLATION_QUADRATIC   0x20
 When set, do interpolation for stretching or transforming.
 
#define FSCRT_INTERPOLATION_BICUBIC   0x80
 When set, do bicubic interpolation for stretching or transforming.
 

Macro Definitions for calculation methods of bitmap bounding.

#define FSCRT_BITMAPBBOX_DETECTION   0
 Matching the given background color exactly.
 
#define FSCRT_BITMAPBBOX_BACKCOLOR   1
 Detecting a bounding box by analyzing a bitmap.
 

Macro definitions for image types

#define FSCRT_IMAGETYPE_BMP   1
 Image type is BMP.
 
#define FSCRT_IMAGETYPE_JPG   2
 Image type is JPG or JPeg.
 
#define FSCRT_IMAGETYPE_PNG   3
 Image type is PNG.
 
#define FSCRT_IMAGETYPE_GIF   4
 Image type is GIF.
 
#define FSCRT_IMAGETYPE_TIF   5
 Image type is TIF or TIFF.
 
#define FSCRT_IMAGETYPE_JPX   6
 Image type is JPX or JPeg-2000.
 
#define FSCRT_IMAGETYPE_JBIG2   8
 Image type is JBIG2. More...
 

Macro definitions for image properties

Note
Image properties are used in the function FSCRT_Image_GetProperty and FSCRT_ImageFile_SetProperty.
#define FSCRT_IMAGEPROPERTY_DPI   "dpi"
 DPI, that is Dot-Per-Inch. More...
 

Detailed Description

Definitions for image functionality.
Definitions and functions in this module are included in fs_image_r.h and fs_image_w.h.
Module: Image
License Identifier: Image/All
Available License Right: Reading/Writing
For license Right Reading, see fs_image_r.h.
For license Right Writing, see fs_image_w.h.

This module contains the following features:

Macro Definition Documentation

#define FSCRT_IMAGEPROPERTY_DPI   "dpi"

DPI, that is Dot-Per-Inch.

Note
Contains 2 values: the first is DPI value for X-axis, and the second is DPI value for Y-axis. Two values are integer, FSCRT_VAR::type should be FSCRT_VT_INT32.
#define FSCRT_IMAGETYPE_JBIG2   8

Image type is JBIG2.

Note
Currently, Only a few image APIs support this type. If API dose not support this type, FSCRT_ERRCODE_UNSUPPORTED would be returned.

Function Documentation

FS_RESULT FSCRT_Bitmap_CalcBBox ( FSCRT_BITMAP  bitmap,
FS_INT32  flag,
FS_ARGB  backColor,
FS_INT32  windowSize,
FS_INT32  tolerance,
FSCRT_RECT rectBBox 
)

Calculate the bounding box of a bitmap.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[in]flagMethod flag is used to specify how to calculate a bounding box, FSCRT_BITMAPBBOX_DETECTION means matching a given background color backColor exactly, FSCRT_BITMAPBBOX_BACKCOLOR means detecting bounding box by analyzing bitmap contents.
[in]backColorBackground color. It shall be valid only when the parameter flag is 0.
[in]windowSizeDetection size to analyze background, it shall valid only when parameter flag is 1.
[in]toleranceTolerance to indicate color difference when detecting a bounding box, it shall be valid only when the parameter flag is 1. Its value should be between 0 and 255, and the suggested value is 64.
[out]rectBBoxPointer to a FSCRT_RECT structure that receives a bounding box rectangle.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap or rectBBox 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.
  • bitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_Clone ( FSCRT_BITMAP  bitmap,
FSCRT_BITMAP *  clonedBitmap 
)

Clone a bitmap.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[out]clonedBitmapPointer to a FSCRT_BITMAP handle that receives a cloned bitmap.
Applications should release it by calling function FSCRT_Bitmap_Release.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap or clonedBitmap 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.
  • bitmap: this handle is long-term recoverable.
  • clonedBitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_ConvertFormat ( FSCRT_BITMAP  bitmap,
FS_INT32  format 
)

Convert a bitmap to another specific format.

Parameters
[in]bitmapHandle to a bitmap object which is a source bitmap.
[in]formatNew bitmap format type. Please refer to macro definitions FSCRT_BITMAPFORMAT_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap is NULL.
FSCRT_ERRCODE_FORMAT if the parameter format is invalid.
FSCRT_ERRCODE_UNSUPPORTED if the type of bitmap is FSCRT_BITMAPFORMAT_16BPP_RGB565 or format is FSCRT_BITMAPFORMAT_1BPP_RGB.
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.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_Create ( FS_INT32  width,
FS_INT32  height,
FS_INT32  format,
FS_LPVOID  buffer,
FS_INT32  stride,
FSCRT_BITMAP *  bitmap 
)

Create a bitmap.

If the parameter buffer is not NULL, it should be initialized by application; otherwise, Foxit PDF SDK will allocate and initialize the pixels buffer internally.
Application is suggested to use the same colors to initialize bitmaps' pixels buffer as Foxit PDF SDK uses internally:

  • For the bitmap without alpha channel, initialize the pixels buffer with 0xFFFFFFFF.
  • For the bitmap with alpha channel, initialize the pixels buffer with 0x00000000.
Parameters
[in]widthWidth of a bitmap, in pixels.
[in]heightHeight of a bitmap, in pixels.
[in]formatBitmap format type. Please refer to macro definitions FSCRT_BITMAPFORMAT_XXX and this should be one of these macros.
[in]bufferPointer to a buffer that specifies bitmap data.
If it is not NULL, this function will use the parameter buffer to initialize a bitmap. In this case, please do not free the parameter buffer before the parameter bitmap is released.
If it is NULL, a new bitmap buffer will be created internally.
[in]strideThe number of bytes for each scan line, for an external buffer only. If not specified, 4-byte alignment is assumed.
[out]bitmapPointer to a FSCRT_BITMAP handle that receives a created bitmap handle.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap is NULL.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
FSCRT_ERRCODE_UNSUPPORTED if the size of bitmap buffer is greater than 2 GB.
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.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_FillRect ( FSCRT_BITMAP  bitmap,
FS_ARGB  color,
const FSCRT_RECT fillRect 
)

Fill a bitmap object with a specified color.

If the format of bitmap is FSCRT_BITMAPFORMAT_8BPP_GRAY, the gray value for parameter color is computed according to the NTSC video standard, which determines how a color television signal is rendered on a black-and-white television set:
gray = 0.3*red + 0.59*green + 0.11*blue
For more details, please refer to session 6.2.1 "Conversion between DeviceGray and DeviceRGB" in PDF Reference1.7 page 481.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[in]colorColor to fill. If the alpha component is 0 and the filling rectangle is specified, then no color would be filled.
[in]fillRectPointer to a FSCRT_RECT structure to specify a filling rectangle. If it is NULL, the whole bitmap will be filled with a specific color.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap 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.
  • bitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_GetBitmapInfo ( FSCRT_BITMAP  bitmap,
FSCRT_BITMAPINFO bitmapInfo,
FS_DWORD size 
)

Get bitmap information from a given Foxit DIB.

Usually, this function needs to be called twice:
At the first time, set the parameter bitmapInfo to be NULL and get the buffer size, which is returned in the parameter size.
The size is used to allocate bitmapInfo.
At the second time, input bitmapInfo and its size. When this function returns successfully, bitmapInfo will get bitmap information.
The size of bitmapInfo shall not be less than buffer size, and the parameter size shall not be empty.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[out]bitmapInfoPointer to a FSCRT_BITMAPINFO object that recieves dimensions and color information of a bitmap.
If this parameter is NULL, the parameter size will receive buffer size of bitmapInfo in bytes.
[in,out]sizePointer to a FS_DWORD object. It shall not be NULL.
When it is an input parameter, it should be the size of the structure of the parameter bitmapInfo points to.
When it is a return value, it receives an actual buffer size, which is necessary for allocating bitmapInfo when input bitmapInfo is NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap is NULL.
FSCRT_ERRCODE_BUFFEROVERFLOW if the parameter bitmapInfo is not NULL and size is less than the required buffer size.
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.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_GetFlipped ( FSCRT_BITMAP  srcBitmap,
FS_BOOL  flipX,
FS_BOOL  flipY,
FSCRT_BITMAP *  dstBitmap 
)

Swap X/Y dimensions of a bitmap object to generate rotated one.

Parameters
[in]srcBitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[in]flipXA boolean value to indicate whether a flipping image is in horizontal direction (left/right). If it is TRUE, a bitmap will be flipped in horizontal direction.
[in]flipYA boolean value to indicate whether a flipping image is in vertical direction (up/down). If it is TRUE, a bitmap will be flipped in vertical direction.
[out]dstBitmapPointer to a FSCRT_BITMAP handle that receives a result bitmap handle.
Applications should release it by calling the function FSCRT_Bitmap_Release.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter srcBitmap or dstBitmap is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the type of bitmap is FSCRT_BITMAPFORMAT_16BPP_RGB565.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
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.
  • srcBitmap: this handle is long-term recoverable.
  • dstBitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_GetFormat ( FSCRT_BITMAP  bitmap,
FS_INT32 format 
)

Get format of a bitmap object.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[out]formatPointer to a FS_INT32 object that receives the current bitmap format. Please refer to macro definitions FSCRT_BITMAPFORMAT_XXX and this would be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap or format 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.
  • bitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_GetLineBuffer ( FSCRT_BITMAP  bitmap,
FS_INT32  lineIndex,
FS_LPVOID buffer 
)

Get a line buffer of a bitmap object.

Bitmap data are organized in scan-lines, from top to down.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[in]lineIndexThe index of scan-line, from 0 to the (height-1) of bitmap.
[out]bufferPointer to a FS_LPVOID object that receives the buffer address of scan-line. The bitmap buffer is continuous in the memory, so if want to receive the whole bitmap buffer, please set lineIndex to 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap or buffer is NULL.
FSCRT_ERRCODE_NOTFOUND if the parameter lineIndex is out of range.
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.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_GetLineStride ( FSCRT_BITMAP  bitmap,
FS_INT32 stride 
)

Get a row stride of the bitmap.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[out]stridePointer to a FS_INT32 object that receives the row stride of the bitmap.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap or stride 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.
  • bitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_GetMask ( FSCRT_BITMAP  bitmap,
FSCRT_BITMAP *  mask 
)

Get the mask bitmap of a bitmap.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[out]maskPointer to a FSCRT_BITMAP handle that receives the mask bitmap. If there is no mask bitmap, mask will be NULL.
Applications should release it by calling function FSCRT_Bitmap_Release.
Note
Only ARGB format of bitmap is supported now.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap or mask is NULL.
FSCRT_ERRCODE_UNSUPPORTED if a bitmap do not contain the alpha channel.
FSCRT_ERRCODE_ERROR if some other error happened.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
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.
  • mask: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_GetSize ( FSCRT_BITMAP  bitmap,
FS_INT32 width,
FS_INT32 height 
)

Get the size of a bitmap object.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
[out]widthPointer to a FS_INT32 object that receives the width of bitmap in pixels.
[out]heightPointer to a FS_INT32 object that receives the height of bitmap in pixels.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap, width or height 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.
  • bitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_Release ( FSCRT_BITMAP  bitmap)

Destroy a bitmap and release related resources.

If an external buffer is used (specified by the parameter buffer in calling the function FSCRT_Bitmap_Create), it will not be destroyed.

Parameters
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bitmap 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.
  • bitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_StretchTo ( FSCRT_BITMAP  srcBitmap,
FSCRT_BITMAP  dstBitmap,
FS_INT32  dstLeft,
FS_INT32  dstTop,
FS_INT32  dstWidth,
FS_INT32  dstHeight,
const FSCRT_RECT dstClipRect,
FS_INT32  interpolation 
)

Stretch the source bitmap into a new bitmap with different size.

Parameters
[in]srcBitmapHandle to a FSCRT_BITMAP object which is the source bitmap object.
[in]dstBitmapHandle to a FSCRT_BITMAP object which is the destination bitmap object.
[in]dstLeftLeft position in the destination bitmap from which the source bitmap stretch.
[in]dstTopTop position in the destination bitmap from which the source bitmap stretch.
[in]dstWidthWidth in the destination bitmap.
[in]dstHeightHeight in the destination bitmap.
[in]dstClipRectPointer to a FSCRT_RECT structure which is the clipping rectangle in the destination bitmap.
[in]interpolationAn integer value, representing which interpolation algorithm will be used to stretch a bitmap. Please refer to macro definitions FSCRT_INTERPOLATION_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter srcBitmap, dstBitmap or dstClipRect is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the type of bitmap is FSCRT_BITMAPFORMAT_16BPP_RGB565.
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.
  • srcBitmap: this handle is long-term recoverable.
  • dstBitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Bitmap_TransformTo ( FSCRT_BITMAP  srcBitmap,
FSCRT_BITMAP  dstBitmap,
const FSCRT_MATRIX matrix,
const FSCRT_RECT dstClipRect,
FS_INT32  interpolation 
)

Transform a source bitmap into destination one.

Parameters
[in]srcBitmapHandle to a FSCRT_BITMAP object which is a source bitmap object.
[in]dstBitmapHandle to a FSCRT_BITMAP object which is a destination bitmap object.
[in]matrixPointer to a FSCRT_MATRIX structure to specify a transformation matrix.
[in]dstClipRectPointer to a FSCRT_RECT structure which is the clipping rectangle in destination bitmap.
[in]interpolationAn integer value, representing which interpolation algorithm will be used to transform a bitmap. Please refer to macro definitions FSCRT_INTERPOLATION_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter srcBitmap, dstBitmap, matrix or dstClipRect is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the type of bitmap is FSCRT_BITMAPFORMAT_16BPP_RGB565.
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.
  • srcBitmap: this handle is long-term recoverable.
  • dstBitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_CountFrames ( FSCRT_IMAGE  image,
FS_INT32 count 
)

Count frames of an image.

Parameters
[in]imageHandle to a FSCRT_IMAGE object which is an image object.
[out]countPointer to a FS_INT32 object that receives count of all image frames.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_UNSUPPORTED if the image type is FSCRT_IMAGETYPE_JBIG2. FSCRT_ERRCODE_PARAM if the parameter image or count 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.
  • image: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_GetCurrentFrameBitmap ( FSCRT_IMAGE  image,
FSCRT_BITMAP *  bitmap 
)

Retrieve the bitmap of the current frame.

Parameters
[in]imageHandle to a FSCRT_IMAGE object which is an image object.
[out]bitmapPointer to a FSCRT_BITMAP object that receives the retrieved bitmap object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter image or bitmap is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the image type is FSCRT_IMAGETYPE_JBIG2. FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_ERROR if fail to get the current frame bitmap for any other reasons.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
The parameter bitmap shall be released by caller.
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.
  • image: this handle is long-term recoverable.
  • bitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_GetCurrentFrameSize ( FSCRT_IMAGE  image,
FS_INT32 width,
FS_INT32 height 
)

Get width and height of the current frame.

Parameters
[in]imageHandle to a FSCRT_IMAGE object which is an image object.
[out]widthPointer to a FS_INT32 object that receives width of the current frame.
[out]heightPointer to a FS_INT32 object that receives height of current frame.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter image, width or height is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the image type is FSCRT_IMAGETYPE_JBIG2. FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_ERROR if fail to get current frame size for any other reasons.
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.
  • image: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_GetProperty ( FSCRT_IMAGE  image,
const FSCRT_BSTR property,
FSCRT_VAR values,
FS_INT32 count 
)

Get properties of an image.

Parameters
[in]imageHandle to a FSCRT_IMAGE object which is an image object.
[in]propertyPointer to a FSCRT_BSTR structure that specifies the property information of the image, such as EXIF info. Currently, only dpi property is supported. Please refer to macro definition FSCRT_IMAGEPROPERTY_DPI.
[in,out]valuesPointer to a FSCRT_VAR object that receives values, it can be NULL.
[in,out]countPointer to a FS_INT32 object that receives count of values.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter image, property or count is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the image type is FSCRT_IMAGETYPE_JBIG2. FSCRT_ERRCODE_UNSUPPORTED if the string of the parameter property is not "dpi" or the length of parameter property is not 3.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_ERROR if fail to get values of specified image property for any other reasons.
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.
  • image: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_GetSize ( FSCRT_IMAGE  image,
FS_INT32 width,
FS_INT32 height 
)

Get width and height of an image.

Currently, this function does not support TIF format images. If use this function for TIF image, width and height of TIF image will be 0.

Parameters
[in]imageHandle to a FSCRT_IMAGE object which is an image object.
[out]widthPointer to a FS_INT32 object that receives width of image.
[out]heightPointer to a FS_INT32 object that receives height of image.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter image, width or height 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.
  • image: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_GetType ( FSCRT_IMAGE  image,
FS_INT32 type 
)

Get an image type.

Parameters
[in]imageHandle to a FSCRT_IMAGE object which is an image object.
[out]typePointer to a FS_INT32 object that receives an image type. Please refer to macro definitions FSCRT_IMAGETYPE_XXX and this would be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter image or type 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.
  • image: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_LoadFrame ( FSCRT_IMAGE  image,
FS_INT32  frameIndex 
)

Load an image frame by index.

Note
If you want to get the information of the specific frame, you should call this function first.
Parameters
[in]imageHandle to a FSCRT_IMAGE object which is an image object.
[in]frameIndexThe index of a given frame.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter image is NULL.
FSCRT_ERRCODE_NOTFOUND if the parameter frameIndex is out of range.
FSCRT_ERRCODE_UNSUPPORTED if the image type is FSCRT_IMAGETYPE_JBIG2. FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_ERROR if fail to load frames for any other reasons.
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.
  • image: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_LoadFromFile ( FSCRT_FILE  imageFile,
FSCRT_IMAGE *  image 
)

Load an image from an image file.

Foxit PDF SDK supports six types of image files, and they are specified by macro definitions FSCRT_IMAGETYPE_XXX.

Parameters
[in]imageFileHandle to a FSCRT_FILE object which is an image file object.
[out]imagePointer to a FSCRT_IMAGE handle that receives a handle of image object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter imageFile or image is NULL.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access to some type of image is not allowed.
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 load an image for any other reasons.
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.
  • imageFile: this handle is long-term recoverable.
  • image: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_Image_Release ( FSCRT_IMAGE  image)

Release an image object.

Parameters
[in]imageHandle to a FSCRT_IMAGE object which is an image object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter image 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.
  • image: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_ImageFile_AddFrame ( FSCRT_IMAGEFILE  imageFile,
FSCRT_BITMAP  bitmap 
)

Add a frame to image file.

Frame number should match image type. For example, a TIF file supports multiple frames. Applications can add a frame or multiple frames several times.

Parameters
[in]imageFileHandle to a FSCRT_IMAGEFILE object which is an image file object.
[in]bitmapHandle to a FSCRT_BITMAP object which is a bitmap object to be inserted an image file as a new frame. Currently, it can not support:
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter imageFile or bitmap is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the type of parameter imageFile is FSCRT_IMAGETYPE_JBIG2, or the format of parameter bitmap is FSCRT_BITMAPFORMAT_16BPP_RGB565. 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 add image frames for other reasons.
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.
  • imageFile: this handle is long-term recoverable.
  • bitmap: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_ImageFile_Create ( FSCRT_FILE  file,
FS_INT32  imageType,
FS_INT32  frameCount,
FSCRT_IMAGEFILE *  imageFile 
)

Create an image file.

Currently, this function does not support GIF format.

Parameters
[in]fileHandle to a FSCRT_FILE object which is a file object. It should be a new image file, which is to be created.
[in]imageTypeImage type. It should be one of the following macro definitions:
[in]frameCountHow many frames to be created. This parameter can be larger than 1 for TIF because only TIF format supports multiple frames. Return FSCRT_ERRCODE_UNSUPPORTED when it is larger than 1 for the other formats.
[out]imageFilePointer to a FSCRT_IMAGEFILE handle which is an image file object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter file or imageFile is NULL.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access to some types of image is not allowed.
FSCRT_ERRCODE_FORMAT if the parameter imageType indicating is an invalid type.
FSCRT_ERRCODE_UNSUPPORTED if the parameter imageType indicating is FSCRT_IMAGETYPE_GIF or FSCRT_IMAGETYPE_JBIG2, or the frame count is larger than 1 but it is not TIF format.
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 an image file for other reasons.
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.
  • file: this handle is long-term recoverable.
  • imageFile: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_ImageFile_Release ( FSCRT_IMAGEFILE  imageFile)

Release an image file object.

Save all image data into a file, and destroy image file objects.

Parameters
[in]imageFileHandle to a FSCRT_IMAGEFILE object which is an image file object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter imageFile is NULL.
FSCRT_ERRCODE_UNSUPPORTED if the image type is FSCRT_IMAGETYPE_JBIG2. FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
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.
  • imageFile: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSCRT_ImageFile_SetProperty ( FSCRT_IMAGEFILE  imageFile,
const FSCRT_BSTR property,
const FSCRT_VAR values,
FS_INT32  count 
)

Set properties of image.

Currently, this function does not support JPX, GIF and TIF format.

Note
This function is only effective for the frames added later.
Parameters
[in]imageFileHandle to a FSCRT_IMAGEFILE object which is an image file object.
[in]propertyPointer to a FSCRT_BSTR structure which specifies a property name of an image, such as "dpi".
Currently only dpi property is supported. Please refer to macro definition FSCRT_IMAGEPROPERTY_DPI.
[in]valuesPointer to a FSCRT_VAR structure array which represents the values associated to some property.
[in]countCount of elements in parameter values.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter imageFile, property or values is NULL, or count is invalid.
FSCRT_ERRCODE_UNSUPPORTED if the image type is FSCRT_IMAGETYPE_JBIG2 FSCRT_IMAGETYPE_JPX FSCRT_IMAGETYPE_GIF or the string of parameter property is not "dpi" or the length of it is not 3.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
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.
    • imageFile: this handle is long-term recoverable.
    Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
  • If user wants to set the properties of image, this function should be called before calling function FSCRT_ImageFile_AddFrame.

Foxit Corporation