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 source)
Creates a
BufferedImageFactory. |
BufferedImageFactory(ImageProducer source)
Creates a
BufferedImageFactory. |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Aborts the image production.
|
void |
addProgressListener(BufferedImageFactory.ProgressListener listener)
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 listener)
Removes a progress listener from this factory.
|
void |
setSourceRegion(Rectangle region)
Sets the source region (AOI) for the new image.
|
void |
setSourceSubsampling(int xSubsampling,
int ySubsampling)
Sets the source subsampling for the new image.
|
public BufferedImageFactory(Image source)
BufferedImageFactory.source - the source imageIllegalArgumentException - if source == nullpublic BufferedImageFactory(ImageProducer source)
BufferedImageFactory.source - the source image producerIllegalArgumentException - if source == nullpublic BufferedImage getBufferedImage() throws ImageConversionException
BufferedImage extracted from the given
ImageSource. Multiple requests will return the same image.BufferedImageImageConversionException - 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.ColorModelImageConversionException - if the given ImageSource cannot
be converted for some reason.public void dispose()
BufferedImageFactory.public void abort()
public void setSourceRegion(Rectangle region)
region - the source regionpublic void setSourceSubsampling(int xSubsampling,
int ySubsampling)
xSubsampling - horizontal subsampling factorySubsampling - vertical subsampling factorpublic void addProgressListener(BufferedImageFactory.ProgressListener listener)
listener - the progress listenerpublic void removeProgressListener(BufferedImageFactory.ProgressListener listener)
listener - the progress listenerpublic void removeAllProgressListeners()
Copyright © 2024. All rights reserved.