use of javax.imageio.event.IIOReadProgressListener in project jdk8u_jdk by JetBrains.
the class ImageReader method processImageProgress.
/**
* Broadcasts the current percentage of image completion to all
* registered <code>IIOReadProgressListener</code>s by calling
* their <code>imageProgress</code> method. Subclasses may use
* this method as a convenience.
*
* @param percentageDone the current percentage of completion,
* as a <code>float</code>.
*/
protected void processImageProgress(float percentageDone) {
if (progressListeners == null) {
return;
}
int numListeners = progressListeners.size();
for (int i = 0; i < numListeners; i++) {
IIOReadProgressListener listener = (IIOReadProgressListener) progressListeners.get(i);
listener.imageProgress(this, percentageDone);
}
}
use of javax.imageio.event.IIOReadProgressListener in project jdk8u_jdk by JetBrains.
the class ImageReader method processImageComplete.
/**
* Broadcasts the completion of an image read to all registered
* <code>IIOReadProgressListener</code>s by calling their
* <code>imageComplete</code> method. Subclasses may use this
* method as a convenience.
*/
protected void processImageComplete() {
if (progressListeners == null) {
return;
}
int numListeners = progressListeners.size();
for (int i = 0; i < numListeners; i++) {
IIOReadProgressListener listener = (IIOReadProgressListener) progressListeners.get(i);
listener.imageComplete(this);
}
}
use of javax.imageio.event.IIOReadProgressListener in project jdk8u_jdk by JetBrains.
the class ImageReader method processThumbnailStarted.
/**
* Broadcasts the start of a thumbnail read to all registered
* <code>IIOReadProgressListener</code>s by calling their
* <code>thumbnailStarted</code> method. Subclasses may use this
* method as a convenience.
*
* @param imageIndex the index of the image associated with the
* thumbnail.
* @param thumbnailIndex the index of the thumbnail.
*/
protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) {
if (progressListeners == null) {
return;
}
int numListeners = progressListeners.size();
for (int i = 0; i < numListeners; i++) {
IIOReadProgressListener listener = (IIOReadProgressListener) progressListeners.get(i);
listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
}
}
use of javax.imageio.event.IIOReadProgressListener in project jdk8u_jdk by JetBrains.
the class ImageReader method processReadAborted.
/**
* Broadcasts that the read has been aborted to all registered
* <code>IIOReadProgressListener</code>s by calling their
* <code>readAborted</code> method. Subclasses may use this
* method as a convenience.
*/
protected void processReadAborted() {
if (progressListeners == null) {
return;
}
int numListeners = progressListeners.size();
for (int i = 0; i < numListeners; i++) {
IIOReadProgressListener listener = (IIOReadProgressListener) progressListeners.get(i);
listener.readAborted(this);
}
}
use of javax.imageio.event.IIOReadProgressListener in project imageio-ext by geosolutions-it.
the class ImageReadMTCRIF method getImageReader.
/**
* Get the <code>ImageReader</code> and set its input and metadata flag.
* The input set on the reader might not be the same object as the input
* passed in if the latter was replaced by getImageInputStream().
*/
static ImageReader getImageReader(ParameterBlock pb) {
// Get the input.
Object input = pb.getObjectParameter(0);
// Get the reader parameter.
ImageReader reader = (ImageReader) pb.getObjectParameter(8);
// Attempt to create an ImageInputStream from the input.
ImageInputStream stream = getImageInputStream(input);
// If no reader passed in, try to find one.
if (reader == null) {
// Get all compatible readers.
Iterator readers = ImageIO.getImageReaders(stream != null ? stream : input);
// service provider indicates that it can decode the input.
if (readers != null && readers.hasNext()) {
do {
ImageReader tmpReader = (ImageReader) readers.next();
ImageReaderSpi readerSpi = tmpReader.getOriginatingProvider();
try {
if (readerSpi.canDecodeInput(stream != null ? stream : input)) {
reader = tmpReader;
}
} catch (IOException ioe) {
// XXX Ignore it?
}
} while (reader == null && readers.hasNext());
}
}
// If reader found, set its input and metadata flag.
if (reader != null) {
// Get the locale parameter and set on the reader.
Locale locale = (Locale) pb.getObjectParameter(6);
if (locale != null) {
reader.setLocale(locale);
}
// Get the listeners parameter and set on the reader.
EventListener[] listeners = (EventListener[]) pb.getObjectParameter(5);
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
EventListener listener = listeners[i];
if (listener instanceof IIOReadProgressListener) {
reader.addIIOReadProgressListener((IIOReadProgressListener) listener);
}
if (listener instanceof IIOReadUpdateListener) {
reader.addIIOReadUpdateListener((IIOReadUpdateListener) listener);
}
if (listener instanceof IIOReadWarningListener) {
reader.addIIOReadWarningListener((IIOReadWarningListener) listener);
}
}
}
// Get the metadata reading flag.
boolean readMetadata = ((Boolean) pb.getObjectParameter(2)).booleanValue();
// Set the input and indicate metadata reading state.
// seekForwardOnly
reader.setInput(// seekForwardOnly
stream != null ? stream : input, // seekForwardOnly
false, // ignoreMetadata
!readMetadata);
}
return reader;
}
Aggregations