Methods Summary |
---|
public void | draw(java.awt.Graphics2D graphics, float x, float y){@inheritDoc}
// translating graphics to draw Shape !!!
graphics.translate((int)x, (int)y);
try {
if (fStroke == STROKE) {
// REMIND: set stroke to correct size
graphics.draw(fShape);
}
else {
graphics.fill(fShape);
}
}
finally {
graphics.translate(-(int)x, -(int)y);
}
|
public boolean | equals(java.awt.font.ShapeGraphicAttribute rhs)Compares this ShapeGraphicAttribute to the specified
ShapeGraphicAttribute .
if (rhs == null) {
return false;
}
if (this == rhs) {
return true;
}
if (fStroke != rhs.fStroke) {
return false;
}
if (getAlignment() != rhs.getAlignment()) {
return false;
}
if (!fShape.equals(rhs.fShape)) {
return false;
}
return true;
|
public boolean | equals(java.lang.Object rhs)Compares this ShapeGraphicAttribute to the specified
Object .
try {
return equals((ShapeGraphicAttribute) rhs);
}
catch(ClassCastException e) {
return false;
}
|
public float | getAdvance()Returns the advance of this ShapeGraphicAttribute .
The advance of a ShapeGraphicAttribute is the distance
from the origin of its Shape to the right side of the
bounds of its Shape .
return (float) Math.max(0, fShapeBounds.getMaxX());
|
public float | getAscent()Returns the ascent of this ShapeGraphicAttribute . The
ascent of a ShapeGraphicAttribute is the positive
distance from the origin of its Shape to the top of
bounds of its Shape .
return (float) Math.max(0, -fShapeBounds.getMinY());
|
public java.awt.geom.Rectangle2D | getBounds()Returns a {@link Rectangle2D} that encloses all of the
bits drawn by this ShapeGraphicAttribute relative to
the rendering position. A graphic can be rendered beyond its
origin, ascent, descent, or advance; but if it does, this method's
implementation should indicate where the graphic is rendered.
Rectangle2D.Float bounds = new Rectangle2D.Float();
bounds.setRect(fShapeBounds);
if (fStroke == STROKE) {
++bounds.width;
++bounds.height;
}
return bounds;
|
public float | getDescent()Returns the descent of this ShapeGraphicAttribute .
The descent of a ShapeGraphicAttribute is the distance
from the origin of its Shape to the bottom of the
bounds of its Shape .
return (float) Math.max(0, fShapeBounds.getMaxY());
|
public java.awt.Shape | getOutline(java.awt.geom.AffineTransform tx)Return a {@link java.awt.Shape} that represents the region that
this ShapeGraphicAttribute renders. This is used when a
{@link TextLayout} is requested to return the outline of the text.
The (untransformed) shape must not extend outside the rectangular
bounds returned by getBounds .
return tx == null ? fShape : tx.createTransformedShape(fShape);
|
public int | hashCode()Returns a hashcode for this ShapeGraphicAttribute .
return fShape.hashCode();
|