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.