|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.ui.Images
This class provides general support methods for image loading.
Field Summary | |
static int |
BUF_SIZE
The size of the buffer used to load images. |
protected static int |
counter_
A sequence counter for image IDs. |
static int |
MAX_LEN
The maximum number of bytes an encoded image may have when reading it via an input stream. |
protected static MediaTracker |
tracker_
The media tracker instance used for waiting until an image is loaded. |
Constructor Summary | |
private |
Images()
No-one may instantiate this class. |
Method Summary | |
static int[] |
getPixels(Image im)
This method grabs the pixels of the given image into an integer array. |
static Image |
newImage(byte[] b)
This method creates a new image from the data in the given byte array. |
static Image |
newImage(InputStream in)
This method reads an image from the given input stream. |
static Image |
newImage(int[] px,
int w,
int h)
This method takes an array of integers of RGB values and returns an image instance. |
static Image |
newImage(URL url)
This method creates a new image from the data read from the given URL. |
static Image |
waitForImage(Image im)
This method waits until the image is loaded. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAX_LEN
public static final int BUF_SIZE
protected static MediaTracker tracker_
protected static int counter_
Constructor Detail |
private Images()
Method Detail |
public static Image newImage(InputStream in) throws IOException, ImageException, InterruptedException
in
- The input stream
ImageException
- if an error occurs
during loading the image.
InterruptedException
- if an interrupt is
raised during loading the image.
IOException
- if guess what...public static Image newImage(byte[] b) throws ImageException, InterruptedException
b
- The byte array holding the encoded image data.
ImageException
- if an error occurs
during loading the image.
InterruptedException
- if an interrupt is
raised during loading the image.public static Image newImage(URL url) throws ImageException, InterruptedException
url
- The URL pointing to the encoded image data.
ImageException
- if an error occurs
during loading the image.
InterruptedException
- if an interrupt is
raised during loading the image.public static Image waitForImage(Image im) throws ImageException, InterruptedException
im
- The image to wait for. If null
is passed then this method returns immediately with
a null
.
ImageException
- if an error occurs
during loading the image.
InterruptedException
- if an interrupt is
raised during loading the image.public static int[] getPixels(Image im) throws ImageException, InterruptedException
IllegalArgumentException
- if the image's
width and height is either not known or null
.
ImageException
- if an error occurs
while grabbing pixels.
InterruptedException
- if an interrupt is
raised while grabbing pixels.public static Image newImage(int[] px, int w, int h)
px
- The pixel data.w
- The width of the image in pixels.h
- The height of the image in pixels.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |