public class IosImageLoader extends ImageLoaderImpl
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.Integer,ImageStorage.ImageType> |
colorSpaceMapping |
private int |
delayTime |
static int |
GRAY
These constants must match with those in native
|
static int |
GRAY_ALPHA |
static int |
GRAY_ALPHA_PRE |
private int |
inHeight |
private int |
inWidth
Set by native code
|
private boolean |
isDisposed |
private int |
loopCount |
private int |
nImages |
static int |
PALETTE |
static int |
PALETTE_ALPHA |
static int |
PALETTE_ALPHA_PRE |
static int |
PALETTE_TRANS |
static int |
RGB |
static int |
RGBA |
static int |
RGBA_PRE |
private long |
structPointer
Pointer to the native loader
|
formatDescription, lastPercentDone, listeners
Constructor and Description |
---|
IosImageLoader(java.io.InputStream inputStream,
ImageDescriptor desc) |
IosImageLoader(java.lang.String urlString,
ImageDescriptor desc) |
Modifier and Type | Method and Description |
---|---|
private void |
checkNativePointer() |
void |
dispose()
Disposes of any resources (such as native libraries) held by this loader.
|
private static void |
disposeLoader(long structPointer)
Destroy a loader.
|
protected void |
finalize() |
private int |
getColorSpaceCode(long structPointer)
Return image color space model code
|
private int |
getDelayTime(long structPointer)
Return image duration for animated images
|
private byte[] |
getImageBuffer(long structPointer,
int imageIndex)
Return a buffer with decompressed image data
|
private int |
getNumberOfComponents(long structPointer)
Return the number of color components
|
private static void |
initNativeLoading()
Set up static method IDs for calls back to Java.
|
ImageFrame |
load(int imageIndex,
int width,
int height,
boolean preserveAspectRatio,
boolean smooth)
Loads the image at a given index in an image stream.
|
private long |
loadImage(java.io.InputStream stream,
boolean reportProgress)
Create a loader and buffer data from the InputStream.
|
private long |
loadImageFromURL(java.lang.String url,
boolean reportProgress)
Create a loader for the given URL.
|
private void |
resizeImage(long structPointer,
int width,
int height)
Set native image size
|
private void |
retrieveDelayTime() |
private void |
setInputParameters(int width,
int height,
int imageCount,
int loopCount)
Called by the native code when input parameters are known.
|
private boolean |
shouldReportProgress() |
private void |
updateProgress(float progressPercentage) |
addListener, emitWarning, getFormatDescription, removeListener, updateImageMetadata, updateImageProgress
public static final int GRAY
public static final int GRAY_ALPHA
public static final int GRAY_ALPHA_PRE
public static final int PALETTE
public static final int PALETTE_ALPHA
public static final int PALETTE_ALPHA_PRE
public static final int PALETTE_TRANS
public static final int RGB
public static final int RGBA
public static final int RGBA_PRE
private static final java.util.Map<java.lang.Integer,ImageStorage.ImageType> colorSpaceMapping
private long structPointer
private int inWidth
private int inHeight
private int nImages
private boolean isDisposed
private int delayTime
private int loopCount
public IosImageLoader(java.lang.String urlString, ImageDescriptor desc) throws java.io.IOException
java.io.IOException
public IosImageLoader(java.io.InputStream inputStream, ImageDescriptor desc) throws java.io.IOException
java.io.IOException
private static void initNativeLoading()
private long loadImage(java.io.InputStream stream, boolean reportProgress) throws java.io.IOException
java.io.IOException
private long loadImageFromURL(java.lang.String url, boolean reportProgress) throws java.io.IOException
java.io.IOException
private void resizeImage(long structPointer, int width, int height)
private byte[] getImageBuffer(long structPointer, int imageIndex)
private int getNumberOfComponents(long structPointer)
private int getColorSpaceCode(long structPointer)
private int getDelayTime(long structPointer)
private static void disposeLoader(long structPointer)
private void setInputParameters(int width, int height, int imageCount, int loopCount)
private void updateProgress(float progressPercentage)
private boolean shouldReportProgress()
private void checkNativePointer() throws java.io.IOException
java.io.IOException
private void retrieveDelayTime()
public void dispose()
ImageLoader
protected void finalize()
finalize
in class java.lang.Object
public ImageFrame load(int imageIndex, int width, int height, boolean preserveAspectRatio, boolean smooth) throws java.io.IOException
ImageLoader
null
will be returned.imageIndex
- the zero-relative index of the image to load.width
- the desired image width. If non-positive,
an IllegalArgumentException
will be thrown.height
- the desired image height. If non-positive,
an IllegalArgumentException
will be thrown.preserveAspectRatio
- whether to preserve the width-to-height ratio
of the image.smooth
- whether to use a smooth downscaling algorithm.null
on error.java.io.IOException