The GraphicAttribute
class represents a graphic embedded
in text. Clients subclass this class to implement their own char
replacement graphics. Clients wishing to embed shapes and images in
text need not subclass this class. Instead, clients can use the
ShapeGraphicAttribute
and ImageGraphicAttribute
classes.
Subclasses must ensure that their objects are immutable once they
are constructed. Mutating a GraphicAttribute
that
is used in a TextLayout
results in undefined behavior from the
TextLayout
.
Modifier and Type | Field and Description |
---|---|
public static final int | BOTTOM_ALIGNMENT
Aligns bottom of graphic to bottom of line. |
public static final int | CENTER_BASELINE
Aligns origin of graphic to center baseline of line. |
private int | |
public static final int | HANGING_BASELINE
Aligns origin of graphic to hanging baseline of line. |
public static final int | ROMAN_BASELINE
Aligns origin of graphic to roman baseline of line. |
public static final int | TOP_ALIGNMENT
Aligns top of graphic to top of line. |
Access | Constructor and Description |
---|---|
protected | GraphicAttribute(int
an int representing one of the
alignment)GraphicAttribute alignment fieldsConstructs a |
Modifier and Type | Method and Description |
---|---|
public abstract void | draw(Graphics2D
the graphics, float Graphics2D into which to render the
graphicthe user-space X coordinate where the graphic is rendered x, float the user-space Y coordinate where the graphic is rendered y)Renders this |
public abstract float | Returns: the advance of thisGraphicAttribute .Returns the advance of this |
public final int | Returns: the alignment of thisGraphicAttribute .Returns the alignment of this |
public abstract float | Returns: the ascent of thisGraphicAttribute .Returns the ascent of this |
public Rectangle2D | Returns: aRectangle2D that encloses all of the bits
rendered by this GraphicAttribute .Returns a |
public abstract float | Returns: the descent of thisGraphicAttribute .Returns the descent of this |
public GlyphJustificationInfo | Returns: aGlyphJustificationInfo object that contains the
justification information for this GraphicAttribute .Returns the justification information for this
|
public Shape | Returns: aShape representing this graphic attribute,
suitable for stroking or filling.an optional tx)AffineTransform to apply to the
outline of this GraphicAttribute . This can be null.Return a |
BOTTOM_ALIGNMENT | back to summary |
---|---|
public static final int BOTTOM_ALIGNMENT Aligns bottom of graphic to bottom of line. |
CENTER_BASELINE | back to summary |
---|---|
public static final int CENTER_BASELINE Aligns origin of graphic to center baseline of line. |
fAlignment | back to summary |
---|---|
private int fAlignment |
HANGING_BASELINE | back to summary |
---|---|
public static final int HANGING_BASELINE Aligns origin of graphic to hanging baseline of line. |
ROMAN_BASELINE | back to summary |
---|---|
public static final int ROMAN_BASELINE Aligns origin of graphic to roman baseline of line. |
TOP_ALIGNMENT | back to summary |
---|---|
public static final int TOP_ALIGNMENT Aligns top of graphic to top of line. |
GraphicAttribute | back to summary |
---|---|
protected GraphicAttribute(int alignment) Constructs a
|
draw | back to summary |
---|---|
public abstract void draw(Graphics2D graphics, float x, float y) Renders this
|
getAdvance | back to summary |
---|---|
public abstract float getAdvance() Returns the advance of this
|
getAlignment | back to summary |
---|---|
public final int getAlignment() Returns the alignment of this
|
getAscent | back to summary |
---|---|
public abstract float getAscent() Returns the ascent of this
|
getBounds | back to summary |
---|---|
public Rectangle2D getBounds() Returns a
|
getDescent | back to summary |
---|---|
public abstract float getDescent() Returns the descent of this
|
getJustificationInfo | back to summary |
---|---|
public GlyphJustificationInfo getJustificationInfo() Returns the justification information for this
|
getOutline | back to summary |
---|---|
public Shape getOutline(AffineTransform tx) Return a
|