public class ImageFile
extends java.lang.Object
ImageFile
class represents an image file object used to
create a specific image file.
ImageFile class offers methods to create a specific image file, add
frames into the image file and set its DPI property.
It can be constructed by the following way.
Example:
ImageFile imagefile = ImageFile.create(FileHandler, int, int);
Modifier and Type | Method and Description |
---|---|
void |
addFrame(Bitmap bitmap)
Add a frame to current
ImageFile object. |
static ImageFile |
create(FileHandler file,
int imageType,
int frameCount)
Create an
ImageFile object. |
long |
getHandle()
Get the handle of an
ImageFile object. |
void |
release()
Release current
ImageFile object. |
void |
setDPI(int[] axis)
Set DPI(Dot-Per-Inch.) properties of current
ImageFile object. |
public long getHandle()
ImageFile
object.ImageFile
object.public static ImageFile create(FileHandler file, int imageType, int frameCount) throws PDFException
ImageFile
object.
Currently this function doesn't support GIF format.
file
- A FileHandler
object which is used to
write the new image data.imageType
- Image type. It should be one of the following: frameCount
- Frame count which specifies how many frames are to be created.
This value can be greater than 1 for TIF image type,
because TIF format supports multiple frames.
But if it's larger than 1 for other formats,
PDFException.ERRCODE_UNSUPPORTED
will be thrown.ImageFile
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
FileHandler
,
Image
public void addFrame(Bitmap bitmap) throws PDFException
ImageFile
object.
Frame number should match the image type. For example, a TIF file supports multiple frames. So applications can add only a frame or multiple frames to TIF image file by calling this function several times. But for other type of image file, application can only add one frame.
bitmap
- A Bitmap
object which is a bitmap object to be
inserted an image file as a new frame. Currently, it can not support the Config.RGB_565 format.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setDPI(int[] axis) throws PDFException
ImageFile
object.
Currently, it doesn't support Image.TYPE_JPX
and Image.TYPE_GIF
.
And it only works after calling function
.
addFrame(Bitmap)
axis
- This must contain 2 values: the first is DPI value for X-axis, and
the second is DPI value for Y-axis.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void release() throws PDFException
ImageFile
object.
Save all image data into a file, and destroy current ImageFile
object.
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException