|
||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||
java.lang.Object | +--uwcse.graphics.ShapeImpl
This is an abstract superclass of all shape objects. All dimensions are in pixels. Shapes are either filled or unfilled. If they are unfilled they are drawn as outlines of the shape. Shapes are always drawn/filled in their color.
| Constructor Summary | |
ShapeImpl(java.awt.Color c,
boolean filled)
A new shaped, possibly filled with the given color. |
|
| Method Summary | |
void |
addTo(GWindow gw)
Add the shape to the given graphics window, if non-null. |
uwcse.graphics.InternalGWindow |
currentWindow()
Return the window this shape is currently displayed on, or null if not displayed on any window. |
Rectangle |
getBoundingBox()
Return the shape's bounding box (the smallest rectangle enclosing the shape). |
int |
getCenterX()
Return the X coordinate of the shape's center |
int |
getCenterY()
Return the Y coordinate of the shape's center |
java.awt.Color |
getColor()
Answer the color of this shape. |
int |
getHeight()
Return the height of the shape's bounding box (the smallest rectangle enclosing the shape). |
int |
getWidth()
Return the width of the shape's bounding box (the smallest rectangle enclosing the shape). |
int |
getX()
Return the X coordinate of the shape's upper-left corner |
int |
getY()
Return the Y coordinate of the shape's upper-left corner |
boolean |
intersects(Shape s)
Return whether this shape's bounding box intersects with the argument shape's bounding box. |
void |
moveBy(int deltaX,
int deltaY)
Change this shape's position. |
void |
moveTo(int x,
int y)
Change this shape's position. |
void |
recordWindow(uwcse.graphics.InternalGWindow gw)
Tell the shape that it belongs to the given window. |
void |
removeFromWindow()
Remove the shape from its graphics window, if it is added to one. |
void |
rotateAround(int pivotX,
int pivotY,
double degrees)
Rotate the shape around the argument coordinates by the given number of degrees, counter-clockwise. |
void |
setColor(java.awt.Color c)
Set the color of this shape. |
java.lang.String |
toString()
Answer the printed representation of this shape. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface uwcse.graphics.Shape |
paint |
| Constructor Detail |
public ShapeImpl(java.awt.Color c,
boolean filled)
c - the color of the shapefilled - whether or not to fill the shape's outline with color| Method Detail |
public void addTo(GWindow gw)
ShapeaddTo in interface Shapeuwcse.graphics.Shapegw - the graphics window to add the shape topublic uwcse.graphics.InternalGWindow currentWindow()
ShapecurrentWindow in interface Shapepublic Rectangle getBoundingBox()
ShapegetBoundingBox in interface Shapepublic int getCenterX()
ShapegetCenterX in interface Shapepublic int getCenterY()
ShapegetCenterY in interface Shapepublic java.awt.Color getColor()
ShapegetColor in interface Shapepublic int getHeight()
ShapegetHeight in interface Shapepublic int getWidth()
ShapegetWidth in interface Shapepublic int getX()
ShapegetX in interface Shapepublic int getY()
ShapegetY in interface Shapepublic boolean intersects(Shape s)
Shapeintersects in interface Shape
public void moveBy(int deltaX,
int deltaY)
ShapemoveBy in interface Shapeuwcse.graphics.ShapedeltaX - offset in the X directiondeltaY - offset in the Y direction
public void moveTo(int x,
int y)
ShapemoveTo in interface Shapeuwcse.graphics.Shapex - new X coordinatey - new Y coordinatepublic void recordWindow(uwcse.graphics.InternalGWindow gw)
ShaperecordWindow in interface Shapepublic void removeFromWindow()
ShaperemoveFromWindow in interface Shape
public void rotateAround(int pivotX,
int pivotY,
double degrees)
ShaperotateAround in interface Shapeuwcse.graphics.ShapepivotX - the X coordinate of the point around which to
rotate the shapepivotY - the Y coordinate of the point around which to
rotate the shapedegrees - the angle to rotate by counter-clockwise, in degreespublic void setColor(java.awt.Color c)
ShapesetColor in interface Shapeuwcse.graphics.Shapec - the new color of the shapepublic java.lang.String toString()
toString in class java.lang.Object
|
||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||