public abstract class GraphicAttribute extends Object
的GraphicAttribute类代表一个图形嵌入文本。客户端子类来实现自己的字符替换图形。希望嵌入在文本中的形状和图像的客户端不需要子类。相反,客户可以用ShapeGraphicAttribute和ImageGraphicAttribute类。
子类必须确保它们的对象是不可变的,一旦它们被构造。变异的GraphicAttribute,用于TextLayout导致未定义的行为从TextLayout。
| Modifier and Type | Field and Description |
|---|---|
static int |
BOTTOM_ALIGNMENT
对齐图形的底部到底部的线。
|
static int |
CENTER_BASELINE
对齐图形到中心线的原点。
|
static int |
HANGING_BASELINE
将图形的原点与挂线的基线对齐。
|
static int |
ROMAN_BASELINE
将图形的原点与罗马基线对齐。
|
static int |
TOP_ALIGNMENT
对齐顶部的图形线顶部。
|
| Modifier | Constructor and Description |
|---|---|
protected |
GraphicAttribute(int alignment)
构建了一个
GraphicAttribute。
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
draw(Graphics2D graphics, float x, float y)
使得这
GraphicAttribute在指定位置。
|
abstract float |
getAdvance()
返回该
GraphicAttribute前进。
|
int |
getAlignment()
返回该
GraphicAttribute对齐。
|
abstract float |
getAscent()
返回该
GraphicAttribute上升。
|
Rectangle2D |
getBounds()
返回一个
Rectangle2D包围所有的位,这
GraphicAttribute相对位置绘制渲染。
|
abstract float |
getDescent()
返回该
GraphicAttribute下降。
|
GlyphJustificationInfo |
getJustificationInfo()
返回此
GraphicAttribute理由信息。
|
Shape |
getOutline(AffineTransform tx)
返回一个
Shape代表区域,这
GraphicAttribute呈现。
|
public static final int TOP_ALIGNMENT
public static final int BOTTOM_ALIGNMENT
public static final int ROMAN_BASELINE
public static final int CENTER_BASELINE
public static final int HANGING_BASELINE
protected GraphicAttribute(int alignment)
GraphicAttribute。子类使用这个定义的图形的对齐。
alignment -表示该领域
GraphicAttribute对准一个int
IllegalArgumentException对准五个定义的值。
public abstract float getAscent()
GraphicAttribute上升。一个图形可以呈现在上升。
GraphicAttribute上升。
getBounds()
public abstract float getDescent()
GraphicAttribute下降。一个图形可以呈现在它的下降。
GraphicAttribute下降。
getBounds()
public abstract float getAdvance()
GraphicAttribute前进。的
GraphicAttribute对象的提出是距离点的图形渲染和点到下一个字符或图形渲染。一个图形可以超越它的进步
GraphicAttribute前进。
getBounds()
public Rectangle2D getBounds()
Rectangle2D包围所有的位,这
GraphicAttribute相对位置绘制渲染。一个图形可能超出它的起源,上升,下降或进步,但如果是,这种方法的实施必须表明图形呈现的地方。默认界限是矩形(0,-上升,前进,上升+下降)。
Rectangle2D包围所有的比特被这
GraphicAttribute。
public Shape getOutline(AffineTransform tx)
Shape代表区域,这
GraphicAttribute呈现。这是用于当一个
TextLayout请求返回文本的轮廓。(原种)的形状不能伸出的
getBounds返回的矩形边界。默认的实现返回返回的矩形
getBounds(),转化提供
AffineTransform如果存在。
tx可选
AffineTransform申请这个
GraphicAttribute纲要。这可以为空。
Shape代表这个图形属性,适合描边或填充。
public abstract void draw(Graphics2D graphics, float x, float y)
GraphicAttribute在指定位置。
graphics -
Graphics2D,渲染图形
x -用户空间X坐标,图形渲染
y -用户空间Y坐标,图形渲染
public final int getAlignment()
GraphicAttribute对齐。对齐可以是一个特定的基线,或到一个行的绝对顶部或底部。
GraphicAttribute对齐。
public GlyphJustificationInfo getJustificationInfo()
GraphicAttribute理由信息。子类可以重写此方法以提供不同的对齐信息。
GlyphJustificationInfo对象包含此
GraphicAttribute理由信息。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.