Currently supported image formats are:
ImageLoaders can be used to:
Note
ImageLoader is implemented in Java on some platforms, which has
certain performance implications. Performance and memory sensitive applications may
benefit from using one of the constructors provided by Image, as these
are implemented natively.
| Modifier and Type | Field and Description |
|---|---|
| public int | backgroundPixel
the background pixel for the logical screen (this corresponds to the GIF89a Background Color Index value). |
| public int | compression
This is the compression used when saving jpeg and png files. |
| public ImageData[] | data
the array of ImageData objects in this ImageLoader. |
| pack-priv List | |
| public int | logicalScreenHeight
the height of the logical screen on which the images reside, in pixels (this corresponds to the GIF89a Logical Screen Height value) |
| public int | logicalScreenWidth
the width of the logical screen on which the images reside, in pixels (this corresponds to the GIF89a Logical Screen Width value) |
| pack-priv static final int | PNG_INTERLACE_METHOD_OFFSET
If the 29th byte of the PNG file is not zero, then it is interlaced. |
| public 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"). |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addImageLoaderListener(ImageLoaderListener
the listener which should be notified listener)Adds the listener to the collection of listeners who will be notified when image data is either partially or completely loaded. |
| pack-priv static long | gdk_pixbuf_new_from_file(String filename)
Returns GdkPixbuf pointer by loading an image from filename (Java string) |
| pack-priv ImageData[] | |
| pack-priv int | getImageFormat(long loader)
Return the type of file from which the image was read by inspecting GdkPixbufFormat from GdkPixbufLoader It is expressed as one of the following values:
|
| public boolean | Returns: true if there are ImageLoaderListeners, and false otherwiseReturns |
| pack-priv boolean | Returns: true iff 29th byte of PNG files is not zeroReturn true if the image is an interlaced PNG file. |
| public ImageData[] | Returns: an array ofImageData objects loaded from the specified input streamthe input stream to load the images from stream)Loads an array of |
| public ImageData[] | |
| pack-priv ImageData[] | loadFromFile(String filename)
Load GdkPixbuf directly using gdk_pixbuf_new_from_file, without FileInputStream. |
| public void | notifyListeners(ImageLoaderEvent
the event)ImageLoaderEvent to send to each ImageLoaderListenerNotifies all image loader listeners that an image loader event has occurred. |
| pack-priv static ImageData | Returns: ImageData with pixbuf dataConvert GdkPixbuf pointer to Java object ImageData |
| public void | removeImageLoaderListener(ImageLoaderListener
the listener which should no longer be notified listener)Removes the listener from the collection of listeners who will be notified when image data is either partially or completely loaded. |
| pack-priv void | |
| public void | save(OutputStream
the output stream to write the images to stream, int the format to write the images in format)Saves the image data in this ImageLoader to the specified stream. |
| public void |
| backgroundPixel | back to summary |
|---|---|
| public int backgroundPixel the background pixel for the logical screen (this corresponds to the GIF89a Background Color Index value). The default is -1 which means 'unspecified background' | |
| compression | back to summary |
|---|---|
| public int compression This is the compression used when saving jpeg and png files. When saving jpeg files, the value is from 1 to 100, where 1 is very high compression but low quality, and 100 is no compression and high quality; default is 75. When saving png files, the value is from 0 to 3, but they do not impact the quality because PNG is lossless compression. 0 is uncompressed, 1 is low compression and fast, 2 is default compression, and 3 is high compression but slow.
| |
| data | back to summary |
|---|---|
| public ImageData[] data 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 | |
| imageLoaderListeners | back to summary |
|---|---|
| pack-priv List<ImageLoaderListener> imageLoaderListeners | |
| logicalScreenHeight | back to summary |
|---|---|
| public int logicalScreenHeight the height of the logical screen on which the images reside, in pixels (this corresponds to the GIF89a Logical Screen Height value) | |
| logicalScreenWidth | back to summary |
|---|---|
| public int logicalScreenWidth the width of the logical screen on which the images reside, in pixels (this corresponds to the GIF89a Logical Screen Width value) | |
| PNG_INTERLACE_METHOD_OFFSET | back to summary |
|---|---|
| pack-priv static final int PNG_INTERLACE_METHOD_OFFSET If the 29th byte of the PNG file is not zero, then it is interlaced. | |
| repeatCount | back to summary |
|---|---|
| public 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"). The default is 1. A value of 0 means 'display repeatedly' | |
| ImageLoader | back to summary |
|---|---|
| public ImageLoader() Construct a new empty ImageLoader. | |
| addImageLoaderListener | back to summary |
|---|---|
| public 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.
An ImageLoaderListener should be added before invoking
one of the receiver's load methods. The listener's
| |
| gdk_pixbuf_new_from_file | back to summary |
|---|---|
| pack-priv static long gdk_pixbuf_new_from_file(String filename) Returns GdkPixbuf pointer by loading an image from filename (Java string) | |
| getImageDataArrayFromStream | back to summary |
|---|---|
| pack-priv ImageData[] getImageDataArrayFromStream(InputStream stream) | |
| getImageFormat | back to summary |
|---|---|
| pack-priv int getImageFormat(long loader) Return the type of file from which the image was read by inspecting GdkPixbufFormat from GdkPixbufLoader It is expressed as one of the following values:
| |
| hasListeners | back to summary |
|---|---|
| public boolean hasListeners() Returns
| |
| isInterlacedPNG | back to summary |
|---|---|
| pack-priv boolean isInterlacedPNG(byte[] imageAsByteArray) Return true if the image is an interlaced PNG file. This is used to check whether ImageLoaderEvent should be fired when loading images.
| |
| load | back to summary |
|---|---|
| public ImageData[] load(InputStream stream) Loads an array of
| |
| load | back to summary |
|---|---|
| public ImageData[] load(String filename) Loads an array of
| |
| loadFromFile | back to summary |
|---|---|
| pack-priv ImageData[] loadFromFile(String filename) Load GdkPixbuf directly using gdk_pixbuf_new_from_file, without FileInputStream. | |
| notifyListeners | back to summary |
|---|---|
| public void notifyListeners(ImageLoaderEvent event) Notifies all image loader listeners that an image loader event has occurred. Pass the specified event object to each listener.
| |
| pixbufToImageData | back to summary |
|---|---|
| pack-priv static ImageData pixbufToImageData(long pixbuf) Convert GdkPixbuf pointer to Java object ImageData
| |
| removeImageLoaderListener | back to summary |
|---|---|
| public 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.
| |
| reset | back to summary |
|---|---|
| pack-priv void reset() Resets the fields of the ImageLoader, except for the
| |
| save | back to summary |
|---|---|
| public void save(OutputStream stream, int format) Saves the image data in this ImageLoader to the specified stream. The format parameter can have one of the following values:
| |
| save | back to summary |
|---|---|
| public void save(String filename, int format) Saves the image data in this ImageLoader to a file with the specified name. The format parameter can have one of the following values:
| |