Class Image
All Packages Class Hierarchy This Package Previous Next Index
Class Image
public abstract class netscape.application.Image
extends java.lang.Object
implements netscape.util.Codable
{
/* Fields
*/
public final static int CENTERED;
public final static java.lang.String IMAGE_TYPE;
public final static int SCALED;
public final static int TILED;
/* Constructors
*/
public Image();
/* Methods
*/
public void decode(Decoder);
public void describeClassInfo(ClassInfo);
public abstract void drawAt(Graphics, int, int);
public void drawCentered(Graphics, int, int, int, int);
public void drawCentered(Graphics, Rect);
public void drawScaled(Graphics, int, int, int, int);
public void drawScaled(Graphics, Rect);
public void drawTiled(Graphics, int, int, int, int);
public void drawTiled(Graphics, Rect);
public void drawWithStyle(Graphics, int, int, int, int, int);
public void drawWithStyle(Graphics, Rect, int);
public void encode(Encoder);
public void finishDecoding();
public abstract int height();
public boolean isTransparent();
public String name();
public abstract int width();
}
Abstract Object subclass representing objects that have an intrinsic
width and height and can draw themselves to a Graphics object. Bitmap and
DrawingSequence are two concrete implementations of the abstract Image
class. Many user interface elements take Images to customize their
appearance. By implementing the three primitive Image methods, you can
create custom Images and use them with any component that accepts Images.
Image also provides several convenience methods for drawing itself
centered, scaled and tiled.
Fields
CENTERED
public final static int CENTERED
- Display option that centers the Image within a rectangle.
SCALED
public final static int SCALED
- Display option that scales the Image within a rectangle.
TILED
public final static int TILED
- Display option that tiles the Image within a rectangle.
IMAGE_TYPE
public final static String IMAGE_TYPE
- Drag type.
Constructors
Image
public Image()
Methods
width
public abstract int width()
- Returns the Image's width. Subclassers must implement this method
to return the subclass instance's width.
height
public abstract int height()
- Returns the Image's height. Subclassers must implement this method
to return the subclass instance's height.
drawAt
public abstract void drawAt(Graphics g,
int x,
int y)
- Draws the Image at the given location. Subclassers must implement
this method to draw the subclass instance using the Graphics g.
drawScaled
public void drawScaled(Graphics g,
int x,
int y,
int width,
int height)
- Draws the Image scaled to fit the supplied rectangle. This method
will not correctly scale most Image subclasses. In cases where this
method produces incorrect scaling, subclassers should override and
implement their own scaling algorithm.
name
public String name()
- Returns the Image's name. Default implementation returns null.
Subclassers should override to return the Image's name.
drawCentered
public void drawCentered(Graphics g,
int x,
int y,
int width,
int height)
- Draws the Image centered in the supplied rectangle. Computes a
location and calls drawAt().
drawCentered
public void drawCentered(Graphics g,
Rect rect)
- Draws the Image centered in the Rect rect. Calls the primitive
drawCentered().
- See Also:
- drawCentered
drawScaled
public void drawScaled(Graphics g,
Rect rect)
- Draws the Image scaled in the Rect rect. Calls the primitive
drawScaled().
- See Also:
- drawScaled
drawTiled
public void drawTiled(Graphics g,
int x,
int y,
int width,
int height)
- Draws the Image tiled in the supplied rectangle. Calls
drawAt() for each tile.
drawTiled
public void drawTiled(Graphics g,
Rect rect)
- Draws the Image tiled in the Rect rect. Calls the primitive
drawTiled().
- See Also:
- drawTiled
drawWithStyle
public void drawWithStyle(Graphics g,
int x,
int y,
int width,
int height,
int style)
- Calls drawCentered(), drawScaled(), or
drawTiled() based on the style parameter. style
can be one of CENTERED, SCALED or TILED.
drawWithStyle
public void drawWithStyle(Graphics g,
Rect rect,
int style)
- Convenience method for calling drawWithStyle() with Rect
rect. Equivalent to the code:
drawWithStyle(g, rect.x, rect.y, rect.width, rect.height, style).
- See Also:
- drawWithStyle
isTransparent
public boolean isTransparent()
- Returns true if the Image is transparent. Images are assumed
to be transparent unless the subclass overrides this method. Returning
true is always safe, but an Image user may
be able to avoid drawing the region under the Image if this method
returns false.
describeClassInfo
public void describeClassInfo(ClassInfo info)
- Defined so that Images are Codable. Stateless Images need not
implement.
- See Also:
- describeClassInfo
encode
public void encode(Encoder encoder) throws CodingException
- Defined so that Images are Codable. Stateless Images need not
implement.
- See Also:
- encode
decode
public void decode(Decoder decoder) throws CodingException
- Defined so that Images are Codable. Stateless Images need not
implement.
- See Also:
- decode
finishDecoding
public void finishDecoding() throws CodingException
- Defined so that Images are Codable. Stateless Images need not
implement.
- See Also:
- finishDecoding
All Packages Class Hierarchy This Package Previous Next Index