- java.lang.Object
-
- javax.imageio.IIOImage
-
public 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 aRaster
. Reader methods that return anIIOImage
will always return aBufferedImage
using theRenderedImage
reference. Writer methods that accept anIIOImage
will always accept aRenderedImage
, and may optionally accept aRaster
.Exactly one of
getRenderedImage
andgetRaster
will return a non-null
value. Subclasses are responsible for ensuring this behavior.- See Also:
ImageReader.readAll(int, ImageReadParam)
,ImageReader.readAll(java.util.Iterator)
,ImageWriter.write(javax.imageio.metadata.IIOMetadata, IIOImage, ImageWriteParam)
,ImageWriter.write(IIOImage)
,ImageWriter.writeToSequence(IIOImage, ImageWriteParam)
,ImageWriter.writeInsert(int, IIOImage, ImageWriteParam)
-
-
Field Summary
Fields Modifier and Type Field and Description protected RenderedImage
image
TheRenderedImage
being referenced.protected IIOMetadata
metadata
AnIIOMetadata
object containing metadata associated with the image.protected Raster
raster
TheRaster
being referenced.protected List<? extends BufferedImage>
thumbnails
AList
ofBufferedImage
thumbnails, ornull
.
-
Constructor Summary
Constructors Constructor and Description IIOImage(Raster raster, List<? extends BufferedImage> thumbnails, IIOMetadata metadata)
Constructs anIIOImage
containing aRaster
, and thumbnails and metadata associated with it.IIOImage(RenderedImage image, List<? extends BufferedImage> thumbnails, IIOMetadata metadata)
Constructs anIIOImage
containing aRenderedImage
, and thumbnails and metadata associated with it.
-
Method Summary
Methods Modifier and Type Method and Description IIOMetadata
getMetadata()
Returns a reference to the currentIIOMetadata
object, ornull
is none is set.int
getNumThumbnails()
Returns the number of thumbnails stored in thisIIOImage
.Raster
getRaster()
Returns the currently setRaster
, ornull
if only aRenderedImage
is available.RenderedImage
getRenderedImage()
Returns the currently setRenderedImage
, ornull
if only aRaster
is available.BufferedImage
getThumbnail(int index)
Returns a thumbnail associated with the main image.List<? extends BufferedImage>
getThumbnails()
Returns the currentList
of thumbnailBufferedImage
s, ornull
if none is set.boolean
hasRaster()
Returnstrue
if thisIIOImage
stores aRaster
rather than aRenderedImage
.void
setMetadata(IIOMetadata metadata)
Sets theIIOMetadata
to a new object, ornull
.void
setRaster(Raster raster)
Sets the currentRaster
.void
setRenderedImage(RenderedImage image)
Sets the currentRenderedImage
.void
setThumbnails(List<? extends BufferedImage> thumbnails)
Sets the list of thumbnails to a newList
ofBufferedImage
s, or tonull
.
-
-
-
Field Detail
-
image
protected RenderedImage image
TheRenderedImage
being referenced.
-
raster
protected Raster raster
TheRaster
being referenced.
-
thumbnails
protected List<? extends BufferedImage> thumbnails
AList
ofBufferedImage
thumbnails, ornull
. Non-BufferedImage
objects must not be stored in thisList
.
-
metadata
protected IIOMetadata metadata
AnIIOMetadata
object containing metadata associated with the image.
-
-
Constructor Detail
-
IIOImage
public IIOImage(RenderedImage image, List<? extends BufferedImage> thumbnails, IIOMetadata metadata)
Constructs anIIOImage
containing aRenderedImage
, and thumbnails and metadata associated with it.All parameters are stored by reference.
The
thumbnails
argument must either benull
or contain onlyBufferedImage
objects.- Parameters:
image
- aRenderedImage
.thumbnails
- aList
ofBufferedImage
s, ornull
.metadata
- anIIOMetadata
object, ornull
.- Throws:
IllegalArgumentException
- ifimage
isnull
.
-
IIOImage
public IIOImage(Raster raster, List<? extends BufferedImage> thumbnails, IIOMetadata metadata)
Constructs anIIOImage
containing aRaster
, and thumbnails and metadata associated with it.All parameters are stored by reference.
- Parameters:
raster
- aRaster
.thumbnails
- aList
ofBufferedImage
s, ornull
.metadata
- anIIOMetadata
object, ornull
.- Throws:
IllegalArgumentException
- ifraster
isnull
.
-
-
Method Detail
-
getRenderedImage
public RenderedImage getRenderedImage()
Returns the currently setRenderedImage
, ornull
if only aRaster
is available.- Returns:
- a
RenderedImage
, ornull
. - See Also:
setRenderedImage(java.awt.image.RenderedImage)
-
setRenderedImage
public void setRenderedImage(RenderedImage image)
Sets the currentRenderedImage
. The value is stored by reference. Any existingRaster
is discarded.- Parameters:
image
- aRenderedImage
.- Throws:
IllegalArgumentException
- ifimage
isnull
.- See Also:
getRenderedImage()
-
hasRaster
public boolean hasRaster()
Returnstrue
if thisIIOImage
stores aRaster
rather than aRenderedImage
.- Returns:
true
if aRaster
is available.
-
getRaster
public Raster getRaster()
Returns the currently setRaster
, ornull
if only aRenderedImage
is available.- Returns:
- a
Raster
, ornull
. - See Also:
setRaster(java.awt.image.Raster)
-
setRaster
public void setRaster(Raster raster)
Sets the currentRaster
. The value is stored by reference. Any existingRenderedImage
is discarded.- Parameters:
raster
- aRaster
.- Throws:
IllegalArgumentException
- ifraster
isnull
.- See Also:
getRaster()
-
getNumThumbnails
public int getNumThumbnails()
Returns the number of thumbnails stored in thisIIOImage
.- Returns:
- the number of thumbnails, as an
int
.
-
getThumbnail
public BufferedImage getThumbnail(int index)
Returns a thumbnail associated with the main image.- Parameters:
index
- the index of the desired thumbnail image.- Returns:
- a thumbnail image, as a
BufferedImage
. - Throws:
IndexOutOfBoundsException
- if the supplied index is negative or larger than the largest valid index.ClassCastException
- if a non-BufferedImage
object is encountered in the list of thumbnails at the given index.- See Also:
getThumbnails()
,setThumbnails(java.util.List<? extends java.awt.image.BufferedImage>)
-
getThumbnails
public List<? extends BufferedImage> getThumbnails()
Returns the currentList
of thumbnailBufferedImage
s, ornull
if none is set. A live reference is returned.- Returns:
- the current
List
ofBufferedImage
thumbnails, ornull
. - See Also:
getThumbnail(int)
,setThumbnails(java.util.List<? extends java.awt.image.BufferedImage>)
-
setThumbnails
public void setThumbnails(List<? extends BufferedImage> thumbnails)
Sets the list of thumbnails to a newList
ofBufferedImage
s, or tonull
. The reference to the previousList
is discarded.The
thumbnails
argument must either benull
or contain onlyBufferedImage
objects.- Parameters:
thumbnails
- aList
ofBufferedImage
thumbnails, ornull
.- See Also:
getThumbnail(int)
,getThumbnails()
-
getMetadata
public IIOMetadata getMetadata()
Returns a reference to the currentIIOMetadata
object, ornull
is none is set.- Returns:
- an
IIOMetadata
object, ornull
. - See Also:
setMetadata(javax.imageio.metadata.IIOMetadata)
-
setMetadata
public void setMetadata(IIOMetadata metadata)
Sets theIIOMetadata
to a new object, ornull
.- Parameters:
metadata
- anIIOMetadata
object, ornull
.- See Also:
getMetadata()
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/imageio/iioimage.html/.html/
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.