@OpenApiAll public class Image extends java.lang.Object implements IObserverMessage, IVariable, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
FIT_PAPER
Constants bit for image transformation (auto fit).
|
static int |
FORCE_ROTATE
Constants bit for force rotate
|
static int |
FORCE_ROTATE_LEFT
Constants bit for force rotate (rotate left).
|
static int |
FORCE_ROTATE_RIGHT
Constants bit for force rotate (rotate right).
|
static int |
IMAGE_TYPE_ICON |
static int |
IMAGE_TYPE_IMAGE
Constants for image type that is created as icon or image
|
static int |
LARGE_ONLY
Constants bit for image transformation (perform operation only when image is large only).
|
static int |
MAINTAIN_RATIO
Constants bit for image transformation (maintain ratio).
|
static int |
ROTATE_LEFT
Constants bit for image transformation (rotate left).
|
static int |
ROTATE_RIGHT
Constants bit for image transformation (rotate right).
|
static int |
TRUE_TRANSFORM
Constants bit for image transformation (physically transform image instead of use document feature).
|
Constructor and Description |
---|
Image(java.lang.String id,
java.awt.image.BufferedImage data,
java.lang.String imageFormat,
boolean disposeAfterUse)
Create a new image from buffered image.
|
Image(java.lang.String id,
java.io.File imageFile,
boolean disposeAfterUse)
Create a new image from file.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates and returns a copy of this object.
|
Image |
createOriginal()
Create a new instance of original image.
|
void |
dispose()
Disposes of this image buffer context and releases any system resources that it is using.
|
void |
ensureOriginal() |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
void |
flush()
Flush current buffered image from
getData() into file stream. |
void |
flush(java.lang.Object track)
Flush current buffered image from
getData() into file stream. |
java.awt.Rectangle |
getBounds()
Returns the bounding Rectangle of this Image.
|
java.awt.image.BufferedImage |
getData()
Return a data.
|
int |
getHeight()
Return the height of image in pixels.
|
java.lang.String |
getId()
Return a id.
|
java.io.File |
getImageFile()
Return a imageFile.
|
java.lang.String |
getImageFormat()
Return an image format.
|
java.lang.String |
getImageFormatToWrite() |
int |
getImageType()
Get image type.
|
java.lang.String |
getName()
Return a name.
|
java.awt.Rectangle |
getOriginalBounds()
Returns the original bounding Rectangle of this Image.
|
int |
getOriginalHeight()
Return a original height.
|
java.io.File |
getOriginalImageFile()
Return an original image file.
|
java.lang.String |
getOriginalImageFormat()
Return an original image format.
|
int |
getOriginalWidth()
Return a original width.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties() |
java.lang.Object |
getProperty(java.lang.String key)
Searches for the property with the specified key in this property list.
|
int |
getSize()
Returns the size of image in pixels.
|
int |
getTransformationOption()
Return a transformation flag.
|
int |
getWidth()
Return the width of image in pixels.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isChanged()
Return a changed.
|
boolean |
isDisposeAfterUse()
Return a dispose setting.
|
boolean |
isTransformWithOption(int option)
Test if image transformation option is set to given option.
|
java.awt.image.BufferedImage |
readData()
Read a buffered image from this instance.
|
void |
rotate(boolean clockwise)
Rotate image in clockwise or anti-clockwise.
|
void |
setChanged(boolean changed)
If
false , dispose image buffer and mark a status. |
void |
setData(java.awt.image.BufferedImage data)
Set a data.
|
void |
setDisposeAfterUse(boolean disposeAfterUse)
Set image data to be disposed after generating report.
|
void |
setHeight(int height)
Set height of image in pixels.
|
void |
setId(java.lang.String id)
Set a id.
|
void |
setImageFile(java.io.File imageFile)
Set a imageFile.
|
void |
setImageFormat(java.lang.String imageFormat)
Set an image format.
|
void |
setImageType(int imageType)
Set image type.
|
void |
setName(java.lang.String name)
Set a name.
|
void |
setOriginalHeight(int originalHeight) |
void |
setOriginalImageFile(java.io.File originalImageFile) |
void |
setOriginalImageFormat(java.lang.String originalImageFormat)
Set an original image format.
|
void |
setOriginalWidth(int originalWidth) |
void |
setProperties(java.util.Map<java.lang.String,java.lang.Object> properties) |
void |
setProperty(java.lang.String key,
java.lang.Object value)
Set an image property.
|
void |
setTransformationOption(int transformationOption)
Set a transformation option.
|
void |
setWidth(int width)
Set width of image in pixels.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
public static final int FIT_PAPER
public static final int MAINTAIN_RATIO
public static final int ROTATE_LEFT
public static final int ROTATE_RIGHT
public static final int LARGE_ONLY
public static final int IMAGE_TYPE_IMAGE
public static final int IMAGE_TYPE_ICON
public static final int TRUE_TRANSFORM
public static final int FORCE_ROTATE_LEFT
public static final int FORCE_ROTATE_RIGHT
public static final int FORCE_ROTATE
public Image(java.lang.String id, java.io.File imageFile, boolean disposeAfterUse)
disposeAfterUse
is true, image will be disposed immediately
after print into report.
Generally, same image will be used only once in the template, it's recommend to set
disposeAfterUse
to true.
id
- image idimageFile
- image file.disposeAfterUse
- if true, dispose an image after use.java.lang.IllegalArgumentException
- if image file is nullpublic Image(java.lang.String id, java.awt.image.BufferedImage data, java.lang.String imageFormat, boolean disposeAfterUse)
disposeAfterUse
is true, image will be disposed
immediately after print into report.
Generally, same image will be used only once in the template, it's recommend to set
disposeAfterUse
to true.
data
can be null.
id
- image iddata
- the image dataimageFormat
- the image format.disposeAfterUse
- if true, dispose an image after use.java.lang.IllegalArgumentException
- if image format is nullpublic java.util.Map<java.lang.String,java.lang.Object> getProperties()
public void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
public void setOriginalImageFile(java.io.File originalImageFile)
public void setOriginalWidth(int originalWidth)
public void setOriginalHeight(int originalHeight)
public java.lang.String getId()
public void setId(java.lang.String id)
id
- the id to setpublic java.lang.String getName()
getName
in interface IObserverMessage
public void setName(java.lang.String name)
name
- the name to setpublic java.awt.image.BufferedImage getData()
public void setData(java.awt.image.BufferedImage data)
data
- the data to setpublic java.lang.String getImageFormat()
public void setImageFormat(java.lang.String imageFormat)
imageFormat
- the image format to setpublic java.lang.String getOriginalImageFormat()
public void setOriginalImageFormat(java.lang.String originalImageFormat)
originalImageFormat
- the original image format to setpublic void setProperty(java.lang.String key, java.lang.Object value)
key
- the key to be placed into this property list.value
- the value corresponding to key.public java.lang.Object getProperty(java.lang.String key)
null
if the property is not found.key
- the property key.setProperty(String, Object)
public boolean isChanged()
public void setChanged(boolean changed)
false
, dispose image buffer and mark a status. Developer should detect an image status
before retrieve a new buffer from getData()
.changed
- the changed to setisChanged()
public java.awt.image.BufferedImage readData()
getData()
contains data or read
from getImageFile()
.getData()
or getImageFile()
public void flush() throws java.io.IOException
getData()
into file stream. This method will set a new image file
and dispose the data. The image file will be deleted when this object is garbage collected.java.io.IOException
- when unable to flush the data.getData()
,
getImageFile()
,
flush(Object)
public void flush(java.lang.Object track) throws java.io.IOException
getData()
into file stream. This method will set a new image file
and dispose the data. The image file will be deleted when tracked object is garbage collected.track
- the marker object track flushed file, deleting the file when the marker instance is garbage
collected.java.io.IOException
- when unable to flush the data.getData()
,
getImageFile()
,
flush()
public void dispose()
public int getSize()
public java.awt.Rectangle getBounds()
If image contains no data buffer readData()
return null, the bounds will be calculated
from getWidth()
and getHeight()
.
If image contains buffer data, calculate the bounds from buffer data.
public void setWidth(int width)
width
- width of imagepublic int getWidth()
public void setHeight(int height)
height
- height of image in pixelspublic int getHeight()
public java.io.File getImageFile()
public void setImageFile(java.io.File imageFile)
imageFile
- the imageFile to setpublic boolean isDisposeAfterUse()
public void setDisposeAfterUse(boolean disposeAfterUse)
disposeAfterUse
- set value to true to allow engine to dispose image data.public java.io.File getOriginalImageFile()
public int getOriginalWidth()
public int getOriginalHeight()
public java.awt.Rectangle getOriginalBounds()
public int getTransformationOption()
public void setTransformationOption(int transformationOption)
transformationOption
- the transformation option to setpublic boolean isTransformWithOption(int option)
option
- test optionpublic void rotate(boolean clockwise)
clockwise
- true for clockwise; false for anti-clockwisepublic Image createOriginal()
public void ensureOriginal()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.true
if this object is the same as the obj argument; false
otherwise.Object.equals(java.lang.Object)
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if the object's class does not support the Cloneable
interface.Object.clone()
public java.lang.String toString()
toString
in class java.lang.Object
public int getImageType()
public void setImageType(int imageType)
imageType
- image typepublic java.lang.String getImageFormatToWrite()
Copyright © 2010 - No Magic Asia