public class JPEGImageLoader extends ImageLoaderImpl
Modifier and Type | Class and Description |
---|---|
private static class |
JPEGImageLoader.Lock |
Modifier and Type | Field and Description |
---|---|
private JPEGImageLoader.Lock |
accessLock |
private byte[] |
iccData
Set by setInputAttributes native code callback
|
private int |
inColorSpaceCode
Set by setInputAttributes native code callback.
|
private int |
inHeight
Set by setInputAttributes native code callback
|
private int |
inWidth
Set by setInputAttributes native code callback
|
private boolean |
isDisposed |
static int |
JCS_CMYK |
static int |
JCS_GRAYSCALE |
static int |
JCS_RGB |
static int |
JCS_RGBA |
static int |
JCS_UNKNOWN |
static int |
JCS_YCbCr |
static int |
JCS_YCbCrA |
static int |
JCS_YCC |
static int |
JCS_YCCA |
static int |
JCS_YCCK |
private int |
outColorSpaceCode
Set by setInputAttributes native code callback.
|
private int |
outHeight
Set by setOutputAttributes native code callback.
|
private ImageStorage.ImageType |
outImageType |
private int |
outWidth
Set by setOutputAttributes native code callback.
|
private long |
structPointer
The following variable contains a pointer to the IJG library
structure for this reader.
|
formatDescription, lastPercentDone, listeners
Constructor and Description |
---|
JPEGImageLoader(java.io.InputStream input) |
Modifier and Type | Method and Description |
---|---|
private boolean |
decompressIndirect(long structPointer,
boolean reportProgress,
byte[] array) |
void |
dispose()
Disposes of any resources (such as native libraries) held by this loader.
|
private static void |
disposeNative(long structPointer) |
protected void |
finalize() |
private long |
initDecompressor(java.io.InputStream stream)
Sets up per-reader C structure and returns a pointer to it.
|
private static void |
initJPEGMethodIDs(java.lang.Class inputStreamClass)
Sets up static C structures.
|
ImageFrame |
load(int imageIndex,
int width,
int height,
boolean preserveAspectRatio,
boolean smooth)
Loads the image at a given index in an image stream.
|
private void |
setInputAttributes(int width,
int height,
int colorSpaceCode,
int outColorSpaceCode,
int numComponents,
byte[] iccData) |
private void |
setOutputAttributes(int width,
int height) |
private int |
startDecompression(long structPointer,
int outColorSpaceCode,
int scaleNum,
int scaleDenom)
Sets output color space and scale factor.
|
private void |
updateImageProgress(int outLinesDecoded) |
addListener, emitWarning, getFormatDescription, removeListener, updateImageMetadata, updateImageProgress
public static final int JCS_UNKNOWN
public static final int JCS_GRAYSCALE
public static final int JCS_RGB
public static final int JCS_YCbCr
public static final int JCS_CMYK
public static final int JCS_YCC
public static final int JCS_RGBA
public static final int JCS_YCbCrA
public static final int JCS_YCCA
public static final int JCS_YCCK
private long structPointer
private int inWidth
private int inHeight
private int inColorSpaceCode
private int outColorSpaceCode
private byte[] iccData
private int outWidth
private int outHeight
private ImageStorage.ImageType outImageType
private boolean isDisposed
private JPEGImageLoader.Lock accessLock
JPEGImageLoader(java.io.InputStream input) throws java.io.IOException
java.io.IOException
private static void initJPEGMethodIDs(java.lang.Class inputStreamClass)
private static void disposeNative(long structPointer)
private long initDecompressor(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
private int startDecompression(long structPointer, int outColorSpaceCode, int scaleNum, int scaleDenom)
private boolean decompressIndirect(long structPointer, boolean reportProgress, byte[] array) throws java.io.IOException
java.io.IOException
private void setInputAttributes(int width, int height, int colorSpaceCode, int outColorSpaceCode, int numComponents, byte[] iccData)
private void setOutputAttributes(int width, int height)
private void updateImageProgress(int outLinesDecoded)
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