public class ImageLoader extends Object
Currently supported image formats are:
ImageLoaders can be used to:
| Modifier and Type | Field and Description |
|---|---|
int |
backgroundPixel
the background pixel for the logical screen (this
corresponds to the GIF89a Background Color Index value).
|
ImageData[] |
data
the array of ImageData objects in this ImageLoader.
|
int |
logicalScreenHeight
the height of the logical screen on which the images
reside, in pixels (this corresponds to the GIF89a
Logical Screen Height value)
|
int |
logicalScreenWidth
the width of the logical screen on which the images
reside, in pixels (this corresponds to the GIF89a
Logical Screen Width value)
|
int |
repeatCount
the number of times to repeat the display of a sequence
of animated images (this corresponds to the commonly-used
GIF application extension for "NETSCAPE 2.0 01").
|
| Constructor and Description |
|---|
ImageLoader()
Construct a new empty ImageLoader.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addImageLoaderListener(ImageLoaderListener listener)
Adds the listener to the collection of listeners who will be
notified when image data is either partially or completely loaded.
|
boolean |
hasListeners()
Returns
true if the receiver has image loader
listeners, and false otherwise. |
ImageData[] |
load(InputStream stream)
Loads an array of
ImageData objects from the
specified input stream. |
ImageData[] |
load(String filename)
Loads an array of
ImageData objects from the
file with the specified name. |
void |
notifyListeners(ImageLoaderEvent event)
Notifies all image loader listeners that an image loader event
has occurred.
|
void |
removeImageLoaderListener(ImageLoaderListener listener)
Removes the listener from the collection of listeners who will be
notified when image data is either partially or completely loaded.
|
void |
save(OutputStream stream,
int format)
Saves the image data in this ImageLoader to the specified stream.
|
void |
save(String filename,
int format)
Saves the image data in this ImageLoader to a file with the specified name.
|
public ImageData[] data
public int logicalScreenWidth
public int logicalScreenHeight
public int backgroundPixel
public int repeatCount
public ImageData[] load(InputStream stream)
ImageData objects from the
specified input stream. Throws an error if either an error
occurs while loading the images, or if the images are not
of a supported type. Returns the loaded image data array.stream - the input stream to load the images fromImageData objects loaded from the specified input streamIllegalArgumentException - SWTException - public ImageData[] load(String filename)
ImageData objects from the
file with the specified name. Throws an error if either
an error occurs while loading the images, or if the images are
not of a supported type. Returns the loaded image data array.filename - the name of the file to load the images fromImageData objects loaded from the specified fileIllegalArgumentException - SWTException - public void save(OutputStream stream, int format)
IMAGE_BMPIMAGE_BMP_RLEIMAGE_GIFIMAGE_ICOIMAGE_JPEGIMAGE_PNGstream - the output stream to write the images toformat - the format to write the images inIllegalArgumentException - SWTException - public void save(String filename, int format)
IMAGE_BMPIMAGE_BMP_RLEIMAGE_GIFIMAGE_ICOIMAGE_JPEGIMAGE_PNGfilename - the name of the file to write the images toformat - the format to write the images inIllegalArgumentException - SWTException - public void addImageLoaderListener(ImageLoaderListener listener)
An ImageLoaderListener should be added before invoking
one of the receiver's load methods. The listener's
imageDataLoaded method is called when image
data has been partially loaded, as is supported by interlaced
GIF/PNG or progressive JPEG images.
listener - the listener which should be notifiedIllegalArgumentException - ImageLoaderListener,
ImageLoaderEventpublic void removeImageLoaderListener(ImageLoaderListener listener)
listener - the listener which should no longer be notifiedIllegalArgumentException - addImageLoaderListener(ImageLoaderListener)public boolean hasListeners()
true if the receiver has image loader
listeners, and false otherwise.true if there are ImageLoaderListeners, and false otherwiseaddImageLoaderListener(ImageLoaderListener),
removeImageLoaderListener(ImageLoaderListener)public void notifyListeners(ImageLoaderEvent event)
event - the ImageLoaderEvent to send to each ImageLoaderListenerGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.