org.eclipse.swt.graphics
Class ImageLoader

java.lang.Object
  |
  +--org.eclipse.swt.graphics.ImageLoader

public class ImageLoader
extends Object

Unsafe:


Field Summary
 int backgroundPixel
          Suppressed: the background pixel for the logical screen (this corresponds to the GIF89a Background Color Index value).
 ImageData[] data
          Suppressed: the array of ImageData objects in this ImageLoader.
(package private)  Vector imageLoaderListeners
           
 int logicalScreenHeight
          Suppressed: the height of the logical screen on which the images reside, in pixels (this corresponds to the GIF89a Logical Screen Height value)
 int logicalScreenWidth
          Suppressed: the width of the logical screen on which the images reside, in pixels (this corresponds to the GIF89a Logical Screen Width value)
 int repeatCount
          Suppressed: 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 Summary
ImageLoader()
          Suppressed: Construct a new empty ImageLoader.
 
Method Summary
 void addImageLoaderListener(ImageLoaderListener listener)
          Suppressed: Adds a listener to receive image loader events.
 boolean hasListeners()
          Suppressed: Returns true if the receiver has image loader listeners, and false otherwise.
 ImageData[] load(InputStream stream)
          Suppressed: Loads an array of ImageData objects from the specified input stream.
 ImageData[] load(String filename)
          Suppressed: Loads an array of ImageData objects from the file with the specified name.
 void notifyListeners(ImageLoaderEvent event)
          Suppressed: Notifies all image loader listeners that an image loader event has occurred.
 void removeImageLoaderListener(ImageLoaderListener listener)
          Suppressed: Removes a listener that was receiving image loader events.
(package private)  void reset()
          Resets the fields of the ImageLoader, except for the imageLoaderListeners field.
 void save(OutputStream stream, int format)
          Suppressed: Saves the image data in this ImageLoader to the specified stream.
 void save(String filename, int format)
          Suppressed: Saves the image data in this ImageLoader to a file with the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

public ImageData[] data
Suppressed: the array of ImageData objects in this ImageLoader. This array is read in when the load method is called, and it is written out when the save method is called


logicalScreenWidth

public int logicalScreenWidth
Suppressed: the width of the logical screen on which the images reside, in pixels (this corresponds to the GIF89a Logical Screen Width value)


logicalScreenHeight

public int logicalScreenHeight
Suppressed: the height of the logical screen on which the images reside, in pixels (this corresponds to the GIF89a Logical Screen Height value)


backgroundPixel

public int backgroundPixel
Suppressed: the background pixel for the logical screen (this corresponds to the GIF89a Background Color Index value). The default is -1 which means 'unspecified background'


repeatCount

public int repeatCount
Suppressed: 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")


imageLoaderListeners

Vector imageLoaderListeners
Constructor Detail

ImageLoader

public ImageLoader()
Suppressed: Construct a new empty ImageLoader.

Method Detail

reset

void reset()
Resets the fields of the ImageLoader, except for the imageLoaderListeners field.


load

public ImageData[] load(InputStream stream)
Suppressed: Loads an array of 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.

Parameters:
stream - the input stream to load the images from
Returns:
an array of ImageData objects loaded from the specified input stream

load

public ImageData[] load(String filename)
Suppressed: Loads an array of 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.

Parameters:
filename - the name of the file to load the images from
Returns:
an array of ImageData objects loaded from the specified file

save

public void save(OutputStream stream,
                 int format)
Suppressed: Saves the image data in this ImageLoader to the specified stream. The format parameter can have one of the following values:
IMAGE_BMP
Windows BMP file format, no compression
IMAGE_BMP_RLE
Windows BMP file format, RLE compression if appropriate
IMAGE_GIF
GIF file format
IMAGE_ICO
Windows ICO file format
IMAGE_JPEG
JPEG file format
IMAGE_PNG
PNG file format

Parameters:
stream - the output stream to write the images to
format - the format to write the images in

save

public void save(String filename,
                 int format)
Suppressed: Saves the image data in this ImageLoader to a file with the specified name. The format parameter can have one of the following values:
IMAGE_BMP
Windows BMP file format, no compression
IMAGE_BMP_RLE
Windows BMP file format, RLE compression if appropriate
IMAGE_GIF
GIF file format
IMAGE_ICO
Windows ICO file format
IMAGE_JPEG
JPEG file format
IMAGE_PNG
PNG file format

Parameters:
filename - the name of the file to write the images to
format - the format to write the images in

addImageLoaderListener

public void addImageLoaderListener(ImageLoaderListener listener)
Suppressed: Adds a listener to receive image loader events.

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.

Parameters:
listener - the ImageLoaderListener to add
See Also:
ImageLoaderListener, ImageLoaderEvent

removeImageLoaderListener

public void removeImageLoaderListener(ImageLoaderListener listener)
Suppressed: Removes a listener that was receiving image loader events.

Parameters:
listener - the ImageLoaderListener to remove
See Also:
addImageLoaderListener(org.eclipse.swt.graphics.ImageLoaderListener)

hasListeners

public boolean hasListeners()
Suppressed: Returns true if the receiver has image loader listeners, and false otherwise.

Returns:
true if there are ImageLoaderListeners, and false otherwise
See Also:
addImageLoaderListener(org.eclipse.swt.graphics.ImageLoaderListener), removeImageLoaderListener(org.eclipse.swt.graphics.ImageLoaderListener)

notifyListeners

public void notifyListeners(ImageLoaderEvent event)
Suppressed: Notifies all image loader listeners that an image loader event has occurred. Pass the specified event object to each listener.

Parameters:
event - the ImageLoaderEvent to send to each ImageLoaderListener


comments?