|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.niffty.DrawShape
A DrawShape holds the points defining a shape to be drawn by the Graphics class. A DrawShape should not be confused with the types implementing the java.awt.Shape interface.
Constructor Summary | |
DrawShape()
Creates an empty shape where draw does nothing. |
|
DrawShape(int[] points)
Creates new DrawShape to be drawn by Graphics drawPolyLine. |
Method Summary | |
void |
draw(java.awt.Graphics graphics,
FinalPoint offset)
Same as draw (Graphics, int, int) but takes the offset as a FinalPoint. |
void |
draw(java.awt.Graphics graphics,
int offsetX,
int offsetY)
Draw the shape with the given offset using Graphics drawPolyLine. |
void |
drawLeftOf(java.awt.Graphics graphics,
DrawShape target,
FinalPoint targetOffset,
int gap)
Same as drawLeftOf (Graphics, DrawShape, int, int, int) but takes the offset as a FinalPoint. |
void |
drawLeftOf(java.awt.Graphics graphics,
DrawShape target,
int targetOffsetX,
int targetOffsetY,
int gap)
Draw this shape so that it touches the left edge of the target shape, or if gap is > 0 then place that many pixels of gap between the two shapes. |
int |
getBottomEdge()
Return the bottom edge of the shape which is the maximum Y coordinate. |
int |
getLeftEdge()
Return the left edge of the shape which is the minimum X coordinate. |
int |
getRightEdge()
Return the right edge of the shape which is the maximum X coordinate. |
int |
getTopEdge()
Return the top edge of the shape which is the minimum Y coordinate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DrawShape()
public DrawShape(int[] points)
points
- An array of size 2 * count, where count is the
number of points. The array has the format:
{x0, y0, x1, y1, ...} where x0,y0 is the coordinates
of the first points, etc.Method Detail |
public void draw(java.awt.Graphics graphics, int offsetX, int offsetY)
graphics
- the Graphics context used to draw the shapeoffsetX
- the X amount to offset the shape when drawingoffsetY
- the Y amount to offset the shape when drawingpublic void draw(java.awt.Graphics graphics, FinalPoint offset)
draw(Graphics, int, int)
public void drawLeftOf(java.awt.Graphics graphics, DrawShape target, int targetOffsetX, int targetOffsetY, int gap)
graphics
- the Graphics context used to draw the shapetarget
- the target shape on whose left edge this is drawntargetOffsetX
- the X amount to offset the target shape. Note that
the target shape is placed with the offset and this shape
is placed to the left of it.targetOffsetY
- the Y amount to offset the target shapegap
- amount of space between the two shapes. If zero,
then the two shapes touch. If 1, then there is one
pixel between them, etc.draw(java.awt.Graphics, int, int)
public void drawLeftOf(java.awt.Graphics graphics, DrawShape target, FinalPoint targetOffset, int gap)
(Graphics, DrawShape, int, int, int)
public int getLeftEdge()
public int getRightEdge()
public int getTopEdge()
public int getBottomEdge()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |