public class Image
extends java.lang.Object
Image
class represents various types of image object used in
Foxit PDF SDK.
Image class offers methods to read an specific image type.
It can be constructed by the following ways.
Example:
Image image = Image.load(FileHandler);
Image image = Image.load(Bitmap);
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_BMP
Image type is Bitmap.
|
static int |
TYPE_GIF
Image type is GIF.
|
static int |
TYPE_JPG
Image type is JPG or Jpeg.
|
static int |
TYPE_JPX
Image type is JPX or JPeg-2000.
|
static int |
TYPE_PNG
Image type is PNG.
|
static int |
TYPE_TIF
Image type is TIF or TIFF.
|
Modifier and Type | Method and Description |
---|---|
int |
countFrames()
Count image frames.
|
android.graphics.Bitmap |
getCurrentFrameBitmap()
Retrieve the bitmap of the current frame.
|
Size |
getCurrentFrameSize()
Get width and height of the current frame.
|
int[] |
getDPI()
Get DPI(DPI, that is Dot-Per-Inch.) properties of an
Image
object.This function doesn't support JPX and GIF. |
long |
getHandle()
Get the handle of an
Image object. |
Size |
getSize()
Get the image width and height.
|
int |
getType()
Get the image type.
|
boolean |
isAndroidBitmap()
Checks whether the current bitmap is a android platform bitmap.
|
static Image |
load(android.graphics.Bitmap bitmap)
Load an
Image object from a Bitmap object. |
static Image |
load(FileHandler imageFile)
Load an
Image object from an image file. |
boolean |
loadFrame(int frameIndex)
Load an image frame by index.
|
void |
release()
Release an
Image object. |
public static final int TYPE_BMP
public static final int TYPE_JPG
public static final int TYPE_PNG
public static final int TYPE_GIF
public static final int TYPE_TIF
public static final int TYPE_JPX
public long getHandle()
Image
object.Image
object.public static Image load(FileHandler imageFile) throws PDFException
Image
object from an image file.
Foxit PDF SDK supports six types of image files, and they are specified
by constant definitions
.Image.TYPE_XXX
imageFile
- A FileHandler
object which is an image file.Image
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
FileHandler
public static Image load(android.graphics.Bitmap bitmap) throws PDFException
Image
object from a Bitmap
object.bitmap
- The input Bitmap
object.Image
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public boolean isAndroidBitmap()
boolean
value that indicates whether the current
bitmap is the android platform bitmap or not.public int getType() throws PDFException
Image.TYPE_XXX
and this shall
be one of these constants.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Size getSize() throws PDFException
Get the image width and height except for TIF images. It will return 0,0 for TIF images.
Size
object that receives the image width and height.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Size
public int countFrames() throws PDFException
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public boolean loadFrame(int frameIndex) throws PDFException
If you want to get the information of the specific frame, you should call this function first.
frameIndex
- The index of a given frame.true
if loaded successfully, else return
false
for the parameter frameIndex
is
out of range.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Size getCurrentFrameSize() throws PDFException
Size
object that receives width and height of the current frame.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Size
public android.graphics.Bitmap getCurrentFrameBitmap() throws PDFException
Bitmap
object that receives the retrieved bitmap object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public int[] getDPI() throws PDFException
Image
object.This function doesn't support JPX and GIF.integer
array that receives the property values.
Contains 2 values: the first is DPI value for X-axis, and the
second is DPI value for Y-axis. If this Image loaded from
Bitmap
, this function will return {-1,-1} for it
can't get a bitmap's DPI.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void release() throws PDFException
Image
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException