public class DefaultImageReference extends Object implements Serializable, URLImageContainer, LocalImageContainer
java.awt.Image
. The source
is used to create a higher resolution version if needed. The source file/URL may also be inlined into the output
target, to create better results.
This implementation provides a reasonable default implementation to encapsualte local AWT-images into reports.
The given image might specify a fixed scale factor for the given image. The scaling will be applied before any layout
computations will be performed.Constructor and Description |
---|
DefaultImageReference(DefaultImageReference parent)
Copies the contents of the given DefaultImageReference.
|
DefaultImageReference(Image img)
Creates a new ImageReference without an assigned URL for the Image.
|
DefaultImageReference(int w,
int h)
Creates a new image reference without assigning either an Image or an URL.
|
DefaultImageReference(org.pentaho.reporting.libraries.resourceloader.Resource imageResource) |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Clones this Element.
|
boolean |
equals(Object obj)
Checks for equality.
|
Object |
getIdentity()
Returns the identity information.
|
Image |
getImage()
Returns the original image if available.
|
int |
getImageHeight()
Returns the (unscaled) image height.
|
int |
getImageWidth()
Returns the (unscaled) image width.
|
String |
getName()
Returns the name of this image reference.
|
org.pentaho.reporting.libraries.resourceloader.ResourceKey |
getResourceKey()
Returns the resourcekey that was used to load the image.
|
float |
getScaleX()
Returns a predefined scaling factor.
|
float |
getScaleY()
Returns a predefined scaling factor.
|
URL |
getSourceURL()
Returns the source URL for the image.
|
String |
getSourceURLString()
Returns the a string version of the source URL.
|
int |
hashCode()
Compute a hashcode for this imageReference.
|
boolean |
isIdentifiable()
Checks whether this image has a assigned identity.
|
boolean |
isLoadable()
Checks whether this image reference is loadable.
|
void |
setScale(float sx,
float sy)
Defines a predefined scaling factor.
|
String |
toString()
Returns a String representing this object.
|
public DefaultImageReference(Image img) throws IOException
img
- the image for this reference.NullPointerException
- if the image is null.IOException
- if an IOError occured while loading the image.public DefaultImageReference(org.pentaho.reporting.libraries.resourceloader.Resource imageResource) throws org.pentaho.reporting.libraries.resourceloader.ResourceException
org.pentaho.reporting.libraries.resourceloader.ResourceException
public DefaultImageReference(int w, int h)
w
- the width of the unscaled image.h
- the height of the unscaled image.public DefaultImageReference(DefaultImageReference parent)
parent
- the parent.public Image getImage()
getImage
in interface LocalImageContainer
public URL getSourceURL()
getSourceURL
in interface URLImageContainer
public String getSourceURLString()
getSourceURLString
in interface URLImageContainer
public String toString()
public org.pentaho.reporting.libraries.resourceloader.ResourceKey getResourceKey()
URLImageContainer
getResourceKey
in interface URLImageContainer
public boolean equals(Object obj)
public int hashCode()
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- this should never be thrown.public int getImageWidth()
getImageWidth
in interface ImageContainer
public int getImageHeight()
getImageHeight
in interface ImageContainer
public boolean isLoadable()
isLoadable
in interface URLImageContainer
public Object getIdentity()
getIdentity
in interface LocalImageContainer
public String getName()
getName
in interface LocalImageContainer
public boolean isIdentifiable()
isIdentifiable
in interface LocalImageContainer
public float getScaleX()
getScaleX
in interface ImageContainer
public float getScaleY()
getScaleY
in interface ImageContainer
public void setScale(float sx, float sy)
sx
- the scale factor.sy
- the scale factor.