public final class BufferedImageFactory extends Object
Image
to a
BufferedImage
than using a PixelGrabber
.
Clients may provide progress listeners to monitor conversion progress.
Supports source image subsampling and source region extraction.
Supports source images with 16 bit ColorModel
and
DataBuffer.TYPE_USHORT
transfer type, without converting to
32 bit/TYPE_INT.
NOTE: Does not support images with more than one ColorModel
or
different types of pixel data. This is not very common.Modifier and Type | Class and Description |
---|---|
static interface |
BufferedImageFactory.ProgressListener
This interface allows clients of a
BufferedImageFactory to
receive notifications of decoding progress. |
Constructor and Description |
---|
BufferedImageFactory(Image pSource)
Creates a
BufferedImageFactory . |
BufferedImageFactory(ImageProducer pSource)
Creates a
BufferedImageFactory . |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Aborts the image production.
|
void |
addProgressListener(BufferedImageFactory.ProgressListener pListener)
Adds a progress listener to this factory.
|
void |
dispose()
Frees resources used by this
BufferedImageFactory . |
BufferedImage |
getBufferedImage()
Returns the
BufferedImage extracted from the given
ImageSource . |
ColorModel |
getColorModel()
Returns the
ColorModel extracted from the
given ImageSource . |
void |
removeAllProgressListeners()
Removes all progress listeners from this factory.
|
void |
removeProgressListener(BufferedImageFactory.ProgressListener pListener)
Removes a progress listener from this factory.
|
void |
setSourceRegion(Rectangle pRegion)
Sets the source region (AOI) for the new image.
|
void |
setSourceSubsampling(int pXSub,
int pYSub)
Sets the source subsampling for the new image.
|
public BufferedImageFactory(Image pSource)
BufferedImageFactory
.pSource
- the source imageIllegalArgumentException
- if pSource == null
public BufferedImageFactory(ImageProducer pSource)
BufferedImageFactory
.pSource
- the source image producerIllegalArgumentException
- if pSource == null
public BufferedImage getBufferedImage() throws ImageConversionException
BufferedImage
extracted from the given
ImageSource
. Multiple requests will return the same image.BufferedImage
ImageConversionException
- if the given ImageSource
cannot
be converted for some reason.public ColorModel getColorModel() throws ImageConversionException
ColorModel
extracted from the
given ImageSource
. Multiple requests will return the same model.ColorModel
ImageConversionException
- if the given ImageSource
cannot
be converted for some reason.public void dispose()
BufferedImageFactory
.public void abort()
public void setSourceRegion(Rectangle pRegion)
pRegion
- the source regionpublic void setSourceSubsampling(int pXSub, int pYSub)
pXSub
- horizontal subsampling factorpYSub
- vertical subsampling factorpublic void addProgressListener(BufferedImageFactory.ProgressListener pListener)
pListener
- the progress listenerpublic void removeProgressListener(BufferedImageFactory.ProgressListener pListener)
pListener
- the progress listenerpublic void removeAllProgressListeners()
Copyright © 2017. All rights reserved.