public final class ShapeGraphicAttribute extends GraphicAttribute
Modifier and Type | Field and Description |
---|---|
static boolean |
FILL
True if the shape should be filled.
|
static boolean |
STROKE
True if the shape should be stroked with a 1-pixel wide stroke.
|
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT
Constructor and Description |
---|
ShapeGraphicAttribute(Shape shape,
int alignment,
boolean stroke)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(Graphics2D graphics,
float x,
float y)
Draws the graphic at the given location.
|
boolean |
equals(Object obj)
Compares this ShapeGraphicAttribute to obj.
|
boolean |
equals(ShapeGraphicAttribute rhs)
Compares this ShapeGraphicAttribute to rhs.
|
float |
getAdvance()
Gets the distance from the origin of its Shape to the right side of the
bounds of its Shape.
|
float |
getAscent()
Gets the positive distance from the origin of its Shape to the top of
bounds.
|
Rectangle2D |
getBounds()
Returns a Rectangle2D that encloses all of the bits drawn by this shape.
|
float |
getDescent()
Gets the distance from the origin of its Shape to the bottom of the bounds.
|
int |
hashCode()
Gets the hash code.
|
getAlignment, getJustificationInfo
public static final boolean FILL
public static final boolean STROKE
public ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke)
shape
- - the Shape to render. The Shape is rendered with its origin.alignment
- - the alignmentstroke
- - true if the Shape should be stroked; false if the Shape
should be filled.public void draw(Graphics2D graphics, float x, float y)
draw
in class GraphicAttribute
graphics
- - the graphics to use.x
- - the x location to draw at.y
- - the y location to draw at.public boolean equals(Object obj)
equals
in class Object
obj
- - the object to compare.Object.hashCode()
public boolean equals(ShapeGraphicAttribute rhs)
rhs
- - the ShapeGraphicAttribute to compare.public float getAdvance()
getAdvance
in class GraphicAttribute
public float getAscent()
getAscent
in class GraphicAttribute
public float getDescent()
getDescent
in class GraphicAttribute
public Rectangle2D getBounds()
getBounds
in class GraphicAttribute
public int hashCode()
hashCode
in class Object
Object.equals(Object)
,
System.identityHashCode(Object)