Top Inners Fields Constructors Methods
com.sun.javafx.iio.java2d

public Class J2DImageLoader

extends Object
implements ImageLoader
Class Inheritance
All Implemented Interfaces
com.sun.javafx.iio.ImageLoader
Imports
com.sun.javafx.iio.ImageFormatDescription, .ImageFrame, .ImageLoadListener, .ImageLoader, .ImageMetadata, .ImageStorage.ImageType, .ImageStorageException, com.sun.javafx.iio.common.ImageDescriptor, .ImageTools, javax.imageio.ImageReadParam, .ImageReader, javax.imageio.event.IIOReadProgressListener, .IIOReadWarningListener, javax.imageio.stream.ImageInputStream, java.awt.Dimension, .Image, java.awt.image.BufferedImage, .ComponentSampleModel, .DataBuffer, .DataBufferByte, .DataBufferInt, .IndexColorModel, .MultiPixelPackedSampleModel, .SinglePixelPackedSampleModel, java.io.IOException, java.nio.ByteBuffer, .IntBuffer, java.util.Arrays, .Objects

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final ImageFormatDescription
private final ImageReader
private final ImageInputStream

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addListener(ImageLoadListener
the listener to add.
listener
)

Implements com.sun.javafx.iio.ImageLoader.addListener.

Adds a listener to monitor this loader.

public void
dispose()

Implements com.sun.javafx.iio.ImageLoader.dispose.

Disposes of any resources (such as native libraries) held by this loader.

private static ByteBuffer
public ImageFormatDescription
getFormatDescription()

Implements com.sun.javafx.iio.ImageLoader.getFormatDescription.

Gets a description of the image format supported by this loader.

private static IntBuffer
public ImageFrame
load(int
the zero-relative index of the image to load.
imageIndex
,
double
the desired image width. If non-positive, an IllegalArgumentException will be thrown.
w
,
double
the desired image height. If non-positive, an IllegalArgumentException will be thrown.
h
,
boolean
whether to preserve the width-to-height ratio of the image.
preserveAspectRatio
,
boolean
whether to use a smooth downscaling algorithm.
smooth
,
float
screen pixel scale (used for variable-density images)
screenPixelScale
,
float
image pixel scale (used for fixed-density images)
imagePixelScale
)

Implements com.sun.javafx.iio.ImageLoader.load.

Loads the image at a given index in an image stream.

public void
removeListener(ImageLoadListener
the listener to remove.
listener
)

Implements com.sun.javafx.iio.ImageLoader.removeListener.

Removes a listener from the list of those monitoring this loader.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

descriptionback to summary
private final ImageFormatDescription description
readerback to summary
private final ImageReader reader
streamback to summary
private final ImageInputStream stream

Constructor Detail

J2DImageLoaderback to summary
public J2DImageLoader(ImageReader reader, ImageInputStream stream) throws IOException

Method Detail

addListenerback to summary
public void addListener(ImageLoadListener listener)

Implements com.sun.javafx.iio.ImageLoader.addListener.

Doc from com.sun.javafx.iio.ImageLoader.addListener.

Adds a listener to monitor this loader.

Parameters
listener:ImageLoadListener

the listener to add.

Annotations
@Override
disposeback to summary
public void dispose()

Implements com.sun.javafx.iio.ImageLoader.dispose.

Doc from com.sun.javafx.iio.ImageLoader.dispose.

Disposes of any resources (such as native libraries) held by this loader. Any further invocation of any methods on this object are undefined.

Annotations
@Override
getByteBufferback to summary
private static ByteBuffer getByteBuffer(DataBuffer buffer)
getFormatDescriptionback to summary
public ImageFormatDescription getFormatDescription()

Implements com.sun.javafx.iio.ImageLoader.getFormatDescription.

Doc from com.sun.javafx.iio.ImageLoader.getFormatDescription.

Gets a description of the image format supported by this loader.

Returns:ImageFormatDescription

a description of the image format handled by this loader.

Annotations
@Override
getIntBufferback to summary
private static IntBuffer getIntBuffer(DataBuffer buffer)
loadback to summary
public ImageFrame load(int imageIndex, double w, double h, boolean preserveAspectRatio, boolean smooth, float screenPixelScale, float imagePixelScale) throws IOException

Implements com.sun.javafx.iio.ImageLoader.load.

Doc from com.sun.javafx.iio.ImageLoader.load.

Loads the image at a given index in an image stream. If no image exists at that index null will be returned.

Parameters
imageIndex:int

the zero-relative index of the image to load.

w:double

the desired image width. If non-positive, an IllegalArgumentException will be thrown.

h:double

the desired image height. If non-positive, an IllegalArgumentException will be thrown.

preserveAspectRatio:boolean

whether to preserve the width-to-height ratio of the image.

smooth:boolean

whether to use a smooth downscaling algorithm.

screenPixelScale:float

screen pixel scale (used for variable-density images)

imagePixelScale:float

image pixel scale (used for fixed-density images)

Returns:ImageFrame

the image at the specified index or null on error.

Annotations
@Override
removeListenerback to summary
public void removeListener(ImageLoadListener listener)

Implements com.sun.javafx.iio.ImageLoader.removeListener.

Doc from com.sun.javafx.iio.ImageLoader.removeListener.

Removes a listener from the list of those monitoring this loader.

Parameters
listener:ImageLoadListener

the listener to remove.

Annotations
@Override
com.sun.javafx.iio.java2d back to summary

private final Class J2DImageLoader.LoadListenerImpl

extends Object
implements IIOReadProgressListener, IIOReadWarningListener
Class Inheritance
All Implemented Interfaces
javax.imageio.event.IIOReadWarningListener, java.util.EventListener, javax.imageio.event.IIOReadProgressListener

Field Summary

Modifier and TypeField and Description
private float
private final ImageLoadListener

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public void
imageComplete(ImageReader
the ImageReader object calling this method.
source
)

Implements javax.imageio.event.IIOReadProgressListener.imageComplete.

Reports that the current image read operation has completed.

public void
imageProgress(ImageReader
the ImageReader object calling this method.
source
,
float
the approximate percentage of decoding that has been completed.
percentageDone
)

Implements javax.imageio.event.IIOReadProgressListener.imageProgress.

Reports the approximate degree of completion of the current read call of the associated ImageReader.

public void
imageStarted(ImageReader
the ImageReader object calling this method.
source
,
int
the index of the image being read within its containing input file or stream.
imageIndex
)

Implements javax.imageio.event.IIOReadProgressListener.imageStarted.

Reports that an image read operation is beginning.

public void
readAborted(ImageReader
the ImageReader object calling this method.
source
)

Implements javax.imageio.event.IIOReadProgressListener.readAborted.

Reports that a read has been aborted via the reader's abort method.

public void
sequenceComplete(ImageReader
the ImageReader object calling this method.
source
)

Implements javax.imageio.event.IIOReadProgressListener.sequenceComplete.

Reports that a sequence of read operations has completed.

public void
sequenceStarted(ImageReader
the ImageReader object calling this method.
source
,
int
the index of the first image to be read.
minIndex
)

Implements javax.imageio.event.IIOReadProgressListener.sequenceStarted.

Reports that a sequence of read operations is beginning.

public void
thumbnailComplete(ImageReader
the ImageReader object calling this method.
source
)

Implements javax.imageio.event.IIOReadProgressListener.thumbnailComplete.

Reports that a thumbnail read operation has completed.

public void
thumbnailProgress(ImageReader
the ImageReader object calling this method.
source
,
float
the approximate percentage of decoding that has been completed.
percentageDone
)

Implements javax.imageio.event.IIOReadProgressListener.thumbnailProgress.

Reports the approximate degree of completion of the current getThumbnail call within the associated ImageReader.

public void
thumbnailStarted(ImageReader
the ImageReader object calling this method.
source
,
int
the index of the image being read within its containing input file or stream.
imageIndex
,
int
the index of the thumbnail being read.
thumbnailIndex
)

Implements javax.imageio.event.IIOReadProgressListener.thumbnailStarted.

Reports that a thumbnail read operation is beginning.

public void
warningOccurred(ImageReader
the ImageReader object calling this method.
source
,
String
a String containing the warning.
warning
)

Implements javax.imageio.event.IIOReadWarningListener.warningOccurred.

Reports the occurrence of a non-fatal error in decoding.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

lastProgressback to summary
private float lastProgress
listenerback to summary
private final ImageLoadListener listener

Constructor Detail

LoadListenerImplback to summary
pack-priv LoadListenerImpl(ImageLoadListener listener)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
imageCompleteback to summary
public void imageComplete(ImageReader source)

Implements javax.imageio.event.IIOReadProgressListener.imageComplete.

Doc from javax.imageio.event.IIOReadProgressListener.imageComplete.

Reports that the current image read operation has completed. All ImageReader implementations are required to call this method exactly once upon completion of each image read operation.

Parameters
source:ImageReader

the ImageReader object calling this method.

Annotations
@Override
imageProgressback to summary
public void imageProgress(ImageReader source, float percentageDone)

Implements javax.imageio.event.IIOReadProgressListener.imageProgress.

Doc from javax.imageio.event.IIOReadProgressListener.imageProgress.

Reports the approximate degree of completion of the current read call of the associated ImageReader.

The degree of completion is expressed as a percentage varying from 0.0F to 100.0F. The percentage should ideally be calculated in terms of the remaining time to completion, but it is usually more practical to use a more well-defined metric such as pixels decoded or portion of input stream consumed. In any case, a sequence of calls to this method during a given read operation should supply a monotonically increasing sequence of percentage values. It is not necessary to supply the exact values 0 and 100, as these may be inferred by the callee from other methods.

Each particular ImageReader implementation may call this method at whatever frequency it desires. A rule of thumb is to call it around each 5 percent mark.

Parameters
source:ImageReader

the ImageReader object calling this method.

percentageDone:float

the approximate percentage of decoding that has been completed.

Annotations
@Override
imageStartedback to summary
public void imageStarted(ImageReader source, int imageIndex)

Implements javax.imageio.event.IIOReadProgressListener.imageStarted.

Doc from javax.imageio.event.IIOReadProgressListener.imageStarted.

Reports that an image read operation is beginning. All ImageReader implementations are required to call this method exactly once when beginning an image read operation.

Parameters
source:ImageReader

the ImageReader object calling this method.

imageIndex:int

the index of the image being read within its containing input file or stream.

Annotations
@Override
readAbortedback to summary
public void readAborted(ImageReader source)

Implements javax.imageio.event.IIOReadProgressListener.readAborted.

Doc from javax.imageio.event.IIOReadProgressListener.readAborted.

Reports that a read has been aborted via the reader's abort method. No further notifications will be given.

Parameters
source:ImageReader

the ImageReader object calling this method.

Annotations
@Override
sequenceCompleteback to summary
public void sequenceComplete(ImageReader source)

Implements javax.imageio.event.IIOReadProgressListener.sequenceComplete.

Doc from javax.imageio.event.IIOReadProgressListener.sequenceComplete.

Reports that a sequence of read operations has completed. ImageReader implementations are required to call this method exactly once from their readAll(Iterator) method.

Parameters
source:ImageReader

the ImageReader object calling this method.

Annotations
@Override
sequenceStartedback to summary
public void sequenceStarted(ImageReader source, int minIndex)

Implements javax.imageio.event.IIOReadProgressListener.sequenceStarted.

Doc from javax.imageio.event.IIOReadProgressListener.sequenceStarted.

Reports that a sequence of read operations is beginning. ImageReader implementations are required to call this method exactly once from their readAll(Iterator) method.

Parameters
source:ImageReader

the ImageReader object calling this method.

minIndex:int

the index of the first image to be read.

Annotations
@Override
thumbnailCompleteback to summary
public void thumbnailComplete(ImageReader source)

Implements javax.imageio.event.IIOReadProgressListener.thumbnailComplete.

Doc from javax.imageio.event.IIOReadProgressListener.thumbnailComplete.

Reports that a thumbnail read operation has completed. All ImageReader implementations are required to call this method exactly once upon completion of each thumbnail read operation.

Parameters
source:ImageReader

the ImageReader object calling this method.

Annotations
@Override
thumbnailProgressback to summary
public void thumbnailProgress(ImageReader source, float percentageDone)

Implements javax.imageio.event.IIOReadProgressListener.thumbnailProgress.

Doc from javax.imageio.event.IIOReadProgressListener.thumbnailProgress.

Reports the approximate degree of completion of the current getThumbnail call within the associated ImageReader. The semantics are identical to those of imageProgress.

Parameters
source:ImageReader

the ImageReader object calling this method.

percentageDone:float

the approximate percentage of decoding that has been completed.

Annotations
@Override
thumbnailStartedback to summary
public void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex)

Implements javax.imageio.event.IIOReadProgressListener.thumbnailStarted.

Doc from javax.imageio.event.IIOReadProgressListener.thumbnailStarted.

Reports that a thumbnail read operation is beginning. All ImageReader implementations are required to call this method exactly once when beginning a thumbnail read operation.

Parameters
source:ImageReader

the ImageReader object calling this method.

imageIndex:int

the index of the image being read within its containing input file or stream.

thumbnailIndex:int

the index of the thumbnail being read.

Annotations
@Override
warningOccurredback to summary
public void warningOccurred(ImageReader source, String warning)

Implements javax.imageio.event.IIOReadWarningListener.warningOccurred.

Doc from javax.imageio.event.IIOReadWarningListener.warningOccurred.

Reports the occurrence of a non-fatal error in decoding. Decoding will continue following the call to this method. The application may choose to display a dialog, print the warning to the console, ignore the warning, or take any other action it chooses.

Parameters
source:ImageReader

the ImageReader object calling this method.

warning:String

a String containing the warning.

Annotations
@Override