| 
JavaTM 2 Platform Standard Ed. 6  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.font.GraphicAttribute
public abstract class GraphicAttribute
此类与 CHAR_REPLACEMENT 属性一起使用。
GraphicAttribute 类表示文本中内嵌的图形。客户端创建此类的子类,以实现其自身的 char 替换图形。要在文本中嵌入形状和图像的客户端不必创建此类的子类。相反,客户端可以使用 ShapeGraphicAttribute 和 ImageGraphicAttribute 类。
子类必须确保对象一经构造就不可修改。该变 TextLayout 中使用的 GraphicAttribute 会导致 TextLayout 的不确定行为。
| 字段摘要 | |
|---|---|
static int | 
BOTTOM_ALIGNMENT
将图形底部与行的底部对齐。  | 
static int | 
CENTER_BASELINE
将图形的原点与行的中心基线对齐。  | 
static int | 
HANGING_BASELINE
将图形的原点与行的悬挂基线对齐。  | 
static int | 
ROMAN_BASELINE
将图形的原点与行的罗马字体基线对齐。  | 
static int | 
TOP_ALIGNMENT
将图形顶端与行的顶端对齐。  | 
| 构造方法摘要 | |
|---|---|
protected  | 
GraphicAttribute(int alignment)
构造一个 GraphicAttribute。 | 
| 方法摘要 | |
|---|---|
abstract  void | 
draw(Graphics2D graphics,
float x,
float y)
在指定的位置呈现此 GraphicAttribute。 | 
abstract  float | 
getAdvance()
返回此 GraphicAttribute 的 advance。 | 
 int | 
getAlignment()
返回此 GraphicAttribute 的对齐方式。 | 
abstract  float | 
getAscent()
返回此 GraphicAttribute 的 ascent。 | 
 Rectangle2D | 
getBounds()
返回包括所有位的 Rectangle2D,这些位由与呈现位置相关的 GraphicAttribute 绘制。 | 
abstract  float | 
getDescent()
返回此 GraphicAttribute 的 descent。 | 
 GlyphJustificationInfo | 
getJustificationInfo()
返回此 GraphicAttribute 的调整信息。 | 
 Shape | 
getOutline(AffineTransform tx)
返回表示此 GraphicAttribute 呈现区域的 Shape。 | 
| 从类 java.lang.Object 继承的方法 | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 字段详细信息 | 
|---|
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 值。| 方法详细信息 | 
|---|
public abstract float getAscent()
GraphicAttribute 的 ascent。图形可以在其 ascent 之上呈现。
GraphicAttribute 的 ascent。getBounds()public abstract float getDescent()
GraphicAttribute 的 descent。图形可以在其 descent 之下呈现。
GraphicAttribute 的 descent。getBounds()public abstract float getAdvance()
GraphicAttribute 的 advance。GraphicAttribute 对象的 advance 是呈现该图形的点与呈现下一个字符或图形的点之间的距离。图形可以呈现在其 advance 之外。
GraphicAttribute 的 advance。getBounds()public Rectangle2D getBounds()
Rectangle2D,这些位由与呈现位置相关的 GraphicAttribute 绘制。图形可以在其原点、ascent、descent 和 advance 之外呈现;但是如果这样的话,此方法的实现必须指示呈现该图形的位置。默认的边界是矩形 (0, -ascent, advance, ascent+descent)。
GraphicAttribute 呈现的所有位的 Rectangle2D。public Shape getOutline(AffineTransform tx)
GraphicAttribute 呈现区域的 Shape。当请求 TextLayout 返回文本轮廓时,将使用此方法。(未变换的)Shape 不得超出 getBounds 返回的矩形边界。
默认实现将返回由 getBounds() 返回,并通过提供的 AffineTransform(如果有)变换得到的矩形。
tx - 要应用到此 GraphicAttribute 轮廓的可选 AffineTransform。此参数可以为 null。
Shape,适用于勾画或填充。
public abstract void draw(Graphics2D graphics,
                          float x,
                          float y)
GraphicAttribute。
graphics - 将该图形呈现到的 Graphics2Dx, y - 呈现该图形的用户空间坐标public final int getAlignment()
GraphicAttribute 的对齐方式。可与特定的基线对齐,或与行的绝对顶端或底端对齐。
GraphicAttribute 的对齐方式。public GlyphJustificationInfo getJustificationInfo()
GraphicAttribute 的调整信息。子类可以重写此方法,以提供不同的调整信息。
GraphicAttribute 调整信息的 GlyphJustificationInfo 对象。
  | 
JavaTM 2 Platform Standard Ed. 6  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only。