Packages  This Package  Prev  Next  Index  

§1.24 Class Image

public  abstract  class  java.awt.Image
    extends  java.lang.Object  (I-§1.12)
{
        // Fields
    public final static Object UndefinedProperty;	§1.24.1

        // Constructors
    public Image();	§1.24.2

        // Methods
    public abstract void flush();	§1.24.3
    public abstract Graphics getGraphics();	§1.24.4
    public abstract int getHeight(ImageObserver  observer);	§1.24.5
    public abstract Object	§1.24.6
        getProperty(String  name, ImageObserver  observer);
    public abstract ImageProducer getSource();	§1.24.7
    public abstract int getWidth(ImageObserver  observer)	§1.24.8
}
The abstract class Image is the superclass of all classes that represent graphical images.


Fields

UndefinedProperty

public final static Object UndefinedProperty = new Object()
The UndefinedProperty object should be returned whenever a property which was not defined for a particular image is fetched.

Constructors

Image

public Image()
The default constructor for an image.

Methods

flush

public abstract void flush()
Flushes all resources being used by this Image object.
These resources includes any pixel data that is being cached for rendering to the screen as well as any system resources that are being used to store data or pixels for the image.
The Image object is reset to a state similar to when it was first created so that if it is again rendered, the image data must be recreated or fetched again from its source.

getGraphics

public abstract Graphics getGraphics()
Creates a graphics context (II-§1.20) for drawing to an off-screen image. This method can only be called for off-screen images, which are created with the createImage method(II-§1.10.7) with two integer arguments

Returns:
a graphics context to draw to the off-screen image.

getHeight

public abstract int getHeight(ImageObserver observer)
Determines the height of this image. If the height is not yet known, the observer is notified later.
Parameters:
observer - an object waiting for the image to be loaded
Returns:
the height of the image, or -1 if the height is not yet known.
See Also:
getWidth (II-§1.24.8)
ImageObserver (II-§2.11).

getProperty

public abstract Object
getProperty(String name, ImageObserver observer)
Gets a property of this image by name.
Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the UndefinedProperty object.
If the properties for this image are not yet known, this method returns null and the ImageObserver object is notified later.
The property name "comment" should be used to store an optional comment which can be presented to the application as a description of the image, its source, or its author.
Parameters:
name - a property name
observer - an object waiting for this image to be loaded
Returns:
the value of the named property.
See Also:
ImageObserver (II-§2.11)
UndefinedProperty (II-§1.24.1).

getSource

public abstract ImageProducer getSource()
Returns:
the image producer (II-§2.12) that produces the pixels for this image.

getWidth

public abstract int getWidth(ImageObserver observer)
Determines the width of this image. If the width is not yet known, the observer is notified later.
Parameters:
observer - an object waiting for the image to be loaded
Returns:
the width of this image, or -1 if the width is not yet known.
See Also:
getHeight (II-§1.24.5)
ImageObserver (II-§2.11).

Packages  This Package  Prev  Next  Index
Java API Document (HTML generated by dkramer on April 22, 1996)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com