|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.ou.mlfw.gui.Shadow2D
public abstract class Shadow2D
Shadow2D provides a way for clients or whatever else to draw on a Shadow2DCanvas. The main consideration for a Shadow2D is that the Shadow2DCanvas be able to find its current "real" position as well as set its current "draw" position. A Shadow2D also needs to specify the width and height of a bounding box. This bounding box should but does not have to be respected by the draw method; however, respecting this boundry box can allow a specific implementation of Shadow2DCanvas to provide some convenient handling for special-case drawing conditions (for instance, wrapping a drawing around the borders of a toroidal environment).
Field Summary | |
---|---|
static java.lang.Iterable<Shadow2D> |
EMPTY_ITER
|
Constructor Summary | |
---|---|
Shadow2D(int width,
int height)
Initialize the shadow with a bounding box, calculate the halfwidth and halfheight |
Method Summary | |
---|---|
abstract void |
cleanUp()
A convenience method that gets called after all the drawings are complete and the draw position is reset to the real position. |
abstract void |
draw(java.awt.Graphics2D g)
The actual drawing routine. |
abstract boolean |
drawMe()
Tell the Shadow2DCanvas to draw or not draw this shadow. |
Vector2D |
getDrawPosition()
|
int |
getHalfHeight()
|
int |
getHalfWidth()
|
int |
getHeight()
|
abstract Vector2D |
getRealPosition()
JSpacewarComponent uses this method in conjunction with the bounding box information to determine if the graphic needs to be redrawn to account for wrapping. |
int |
getWidth()
|
void |
resetDrawPosition()
Reset the drawing position to the real position. |
void |
setDrawPosition(Vector2D pos)
Centers the bounding box around a particular point for drawing. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.Iterable<Shadow2D> EMPTY_ITER
Constructor Detail |
---|
public Shadow2D(int width, int height)
width
- The width of the bounding box.height
- The height of the bounding box.Method Detail |
---|
public final int getWidth()
public final int getHalfWidth()
public final int getHeight()
public final int getHalfHeight()
public final void setDrawPosition(Vector2D pos)
pos
- The new drawing position.public final Vector2D getDrawPosition()
public final void resetDrawPosition()
public abstract Vector2D getRealPosition()
public abstract boolean drawMe()
public abstract void draw(java.awt.Graphics2D g)
public abstract void cleanUp()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |