img
Flag
Meaning
The width parameter is valid and contains the width of the image.
WIDTH
The height parameter is valid and contains the height of the image.
HEIGHT
PROPERTIES
The proper ties associated with the image can now be obtained using
imgObj.getProper ty( ).
SOMEBITS
More pixels needed to draw the image have been received. The parameters
left, top, width, and height define the rectangle containing the new pixels.
FRAMEBITS
A complete frame that is par t of a multiframe image, which was previously
drawn, has been received. This frame can be displayed. The left, top, width,
and height parameters are not used.
The image is now complete. The left, top, width, and height parameters are
ALLBITS
not used.
ERROR
An error has occurred to an image that was being tracked asynchronously.
The image is incomplete and cannot be displayed. No fur ther image
information will be received. The ABORT flag will also be set to indicate that
the image production was abor ted.
ABORT
An image that was being tracked asynchronously was abor ted before it was
complete. However, if an error has not occurred, accessing any par t of the
image's data will restar t the production of the image.
TABLE 25-1
Bit Flags of the imageUpdate( ) flags Parameter
Here is a simple example of an imageUpdate( ) method:
public boolean imageUpdate(Image img, int flags,
int x, int y, int w, int h) {
if ((flags & ALLBITS) == 0) {
System.out.println("Still processing the image.");
return true;
} else {
System.out.println("Done processing the image.");
return false;
}
}
Double Buffering
Not only are images useful for storing pictures, as we've just shown, but you can also use
them as offscreen drawing surfaces. This allows you to render any image, including text
and graphics, to an offscreen buffer that you can display at a later time. The advantage to
doing this is that the image is seen only when it is complete. Drawing a complicated image
could take several milliseconds or more, which can be seen by the user as flashing or flickering.
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home