IIOImagepublic class IIOImage extends Object A simple container class to aggregate an image, a set of
thumbnail (preview) images, and an object representing metadata
associated with the image.
The image data may take the form of either a
RenderedImage , or a Raster . Reader
methods that return an IIOImage will always return a
BufferedImage using the RenderedImage
reference. Writer methods that accept an IIOImage
will always accept a RenderedImage , and may optionally
accept a Raster .
Exactly one of getRenderedImage and
getRaster will return a non-null value.
Subclasses are responsible for ensuring this behavior. |
Fields Summary |
---|
protected RenderedImage | imageThe RenderedImage being referenced. | protected Raster | rasterThe Raster being referenced. | protected List | thumbnailsA List of BufferedImage thumbnails,
or null . Non-BufferedImage objects
must not be stored in this List . | protected IIOMetadata | metadataAn IIOMetadata object containing metadata
associated with the image. |
Constructors Summary |
---|
public IIOImage(RenderedImage image, List thumbnails, IIOMetadata metadata)Constructs an IIOImage containing a
RenderedImage , and thumbnails and metadata
associated with it.
All parameters are stored by reference.
The thumbnails argument must either be
null or contain only BufferedImage
objects.
if (image == null) {
throw new IllegalArgumentException("image == null!");
}
this.image = image;
this.raster = null;
this.thumbnails = thumbnails;
this.metadata = metadata;
| public IIOImage(Raster raster, List thumbnails, IIOMetadata metadata)Constructs an IIOImage containing a
Raster , and thumbnails and metadata
associated with it.
All parameters are stored by reference.
if (raster == null) {
throw new IllegalArgumentException("raster == null!");
}
this.raster = raster;
this.image = null;
this.thumbnails = thumbnails;
this.metadata = metadata;
|
Methods Summary |
---|
public javax.imageio.metadata.IIOMetadata | getMetadata()Returns a reference to the current IIOMetadata
object, or null is none is set.
return metadata;
| public int | getNumThumbnails()Returns the number of thumbnails stored in this
IIOImage .
return thumbnails == null ? 0 : thumbnails.size();
| public java.awt.image.Raster | getRaster()Returns the currently set Raster , or
null if only a RenderedImage is
available.
synchronized(this) {
return raster;
}
| public java.awt.image.RenderedImage | getRenderedImage()Returns the currently set RenderedImage , or
null if only a Raster is available.
synchronized(this) {
return image;
}
| public java.awt.image.BufferedImage | getThumbnail(int index)Returns a thumbnail associated with the main image.
if (thumbnails == null) {
throw new IndexOutOfBoundsException("No thumbnails available!");
}
return (BufferedImage)thumbnails.get(index);
| public java.util.List | getThumbnails()Returns the current List of thumbnail
BufferedImage s, or null if none is
set. A live reference is returned.
return thumbnails;
| public boolean | hasRaster()Returns true if this IIOImage stores
a Raster rather than a RenderedImage .
synchronized(this) {
return (raster != null);
}
| public void | setMetadata(javax.imageio.metadata.IIOMetadata metadata)Sets the IIOMetadata to a new object, or
null .
this.metadata = metadata;
| public void | setRaster(java.awt.image.Raster raster)Sets the current Raster . The value is
stored by reference. Any existing RenderedImage is
discarded.
synchronized(this) {
if (raster == null) {
throw new IllegalArgumentException("raster == null!");
}
this.raster = raster;
this.image = null;
}
| public void | setRenderedImage(java.awt.image.RenderedImage image)Sets the current RenderedImage . The value is
stored by reference. Any existing Raster is
discarded.
synchronized(this) {
if (image == null) {
throw new IllegalArgumentException("image == null!");
}
this.image = image;
this.raster = null;
}
| public void | setThumbnails(java.util.List thumbnails)Sets the list of thumbnails to a new List of
BufferedImage s, or to null . The
reference to the previous List is discarded.
The thumbnails argument must either be
null or contain only BufferedImage
objects.
this.thumbnails = thumbnails;
|
|