objectdraw
Class VisibleImage

java.lang.Object
  |
  +--objectdraw.Drawable
        |
        +--objectdraw.Drawable2D
              |
              +--objectdraw.Resizable2D
                    |
                    +--objectdraw.VisibleImage
All Implemented Interfaces:
Drawable2DInterface, DrawableInterface, Resizable2DInterface, java.io.Serializable

public class VisibleImage
extends Resizable2D

VisibleImage is an implementation of an Image that can be drawn to the screen and has all the characteristics of a Resizable2D object.

See Also:
Serialized Form

Field Summary
protected  java.awt.Image image
          The object's image.
 
Fields inherited from class objectdraw.Drawable
canvas, canvasContent, color, DEBUGGING, shown
 
Constructor Summary
VisibleImage(java.awt.Image image, double x, double y, DrawingCanvas c)
          Creates a new VisibleImage object.
VisibleImage(java.awt.Image image, double x, double y, int width, int height, DrawingCanvas c)
          Creates a new VisibleImage object.
VisibleImage(java.awt.Image image, Location origin, DrawingCanvas c)
          Creates a new VisibleImage object.
VisibleImage(java.awt.Image image, Location origin, int width, int height, DrawingCanvas c)
          Creates a new VisibleImage object.
 
Method Summary
 void draw(java.awt.Graphics g)
          Draws the object.
 Bounds getBounds()
          Retrieves the bounding rectangle of the object.
 double getHeight()
          Returns the height of the object's bounding rectangle
 double getWidth()
          Returns the width of the object's bounding rectangle
 void loadImage()
          Completely loads the image data before it returns.
 void move(double dx, double dy)
          Moves the object the specifiec distances in the x and y direction.
 void moveTo(double x, double y)
          Moves the object to the specified x and y coordinates.
 void moveTo(Location location)
          Moves the object to the specified location.
 void setBounds(Bounds b)
          Set the object's bounding box.
 void setHeight(double dist)
          Sets the height of the object's bounding rectangle
 void setWidth(double dist)
          Sets the width of the object's bounding rectangle
 
Methods inherited from class objectdraw.Drawable2D
contains, getLocation, getX, getY, overlaps
 
Methods inherited from class objectdraw.Drawable
addToCanvas, getColor, hide, isHidden, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, setStateChanged, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface objectdraw.Drawable2DInterface
getLocation, getX, getY, overlaps
 
Methods inherited from interface objectdraw.DrawableInterface
addToCanvas, contains, getColor, hide, isHidden, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show
 

Field Detail

image

protected java.awt.Image image
The object's image.
Constructor Detail

VisibleImage

public VisibleImage(java.awt.Image image,
                    Location origin,
                    DrawingCanvas c)
Creates a new VisibleImage object.
Parameters:
image - the image to display
origin - the upper left corner of the bounding rectangle
c - the canvas in which the image is created

VisibleImage

public VisibleImage(java.awt.Image image,
                    double x,
                    double y,
                    DrawingCanvas c)
Creates a new VisibleImage object.
Parameters:
image - the image to display
x - coordinate of the upper left corner of the bounding rectangle
y - coordinate of the upper left corner of the bounding rectangle
c - the canvas in which the image is created

VisibleImage

public VisibleImage(java.awt.Image image,
                    Location origin,
                    int width,
                    int height,
                    DrawingCanvas c)
Creates a new VisibleImage object.
Parameters:
image - the image to display
origin - the upper left corner of the bounding rectangle
width - the width of the bounding rectangle
height - the height of the bounding rectangle
c - the canvas in which the image is created

VisibleImage

public VisibleImage(java.awt.Image image,
                    double x,
                    double y,
                    int width,
                    int height,
                    DrawingCanvas c)
Creates a new VisibleImage object.
Parameters:
image - the image to display
x - coordinate of the upper left corner of the bounding rectangle
y - coordinate of the upper left corner of the bounding rectangle
width - the width of the bounding rectangle
height - the height of the bounding rectangle
c - the canvas in which the image is created
Method Detail

draw

public void draw(java.awt.Graphics g)
Draws the object.
Overrides:
draw in class Drawable2D
Parameters:
g - the graphics context into which the object is drawn

moveTo

public void moveTo(Location location)
Moves the object to the specified location.
Overrides:
moveTo in class Resizable2D
Parameters:
location - the point to which the object is moved

moveTo

public void moveTo(double x,
                   double y)
Moves the object to the specified x and y coordinates.
Overrides:
moveTo in class Drawable
Parameters:
x - horizontal coordinate of point to which object is moved
y - vertical coordinate of point to which object is moved

move

public void move(double dx,
                 double dy)
Moves the object the specifiec distances in the x and y direction.
Overrides:
move in class Resizable2D
Parameters:
dx - the amount to move in the x direction
dy - the amount to move in the y direction

getBounds

public Bounds getBounds()
Retrieves the bounding rectangle of the object.
Returns:
the bounding rectangle

setBounds

public void setBounds(Bounds b)
Set the object's bounding box.
Parameters:
b - the bounding rectangle

setWidth

public void setWidth(double dist)
Sets the width of the object's bounding rectangle
Parameters:
dist - the new width

setHeight

public void setHeight(double dist)
Sets the height of the object's bounding rectangle
Parameters:
dist - the new height

getWidth

public double getWidth()
Returns the width of the object's bounding rectangle

getHeight

public double getHeight()
Returns the height of the object's bounding rectangle
Overrides:
getHeight in class Drawable2D
Following copied from class: objectdraw.Drawable2D
Returns:
the height of the object's bounding rectangle

loadImage

public void loadImage()
Completely loads the image data before it returns.