JavaTM 2 Platform
Standard Ed. 6

java.awt.font
类 ShapeGraphicAttribute

java.lang.Object
  继承者 java.awt.font.GraphicAttribute
      继承者 java.awt.font.ShapeGraphicAttribute

public final class ShapeGraphicAttribute
extends GraphicAttribute

ShapeGraphicAttribute 类是以 TextLayout 形式绘制形状的 GraphicAttribute 的实现。

另请参见:
GraphicAttribute

字段摘要
static boolean FILL
          指示应填充该形状的键。
static boolean STROKE
          指示该形状应使用 1 像素宽的笔画进行勾画的键。
 
从类 java.awt.font.GraphicAttribute 继承的字段
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT
 
构造方法摘要
ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke)
          针对指定 Shape 构造 ShapeGraphicAttribute
 
方法摘要
 void draw(Graphics2D graphics, float x, float y)
          在指定的位置呈现此 GraphicAttribute
 boolean equals(Object rhs)
          将此 ShapeGraphicAttribute 与指定的 Object 进行比较。
 boolean equals(ShapeGraphicAttribute rhs)
          将此 ShapeGraphicAttribute 与指定的 ShapeGraphicAttribute 进行比较。
 float getAdvance()
          返回此 ShapeGraphicAttribute 的 advance。
 float getAscent()
          返回此 ShapeGraphicAttribute 的 ascent。
 Rectangle2D getBounds()
          返回一个 Rectangle2D,它封装此 ShapeGraphicAttribute 相对于呈现位置绘制的所有位。
 float getDescent()
          返回此 ShapeGraphicAttribute 的 descent。
 Shape getOutline(AffineTransform tx)
          返回一个表示此 ShapeGraphicAttribute 呈现区域的 Shape
 int hashCode()
          返回此 ShapeGraphicAttribute 的哈希码。
 
从类 java.awt.font.GraphicAttribute 继承的方法
getAlignment, getJustificationInfo
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

STROKE

public static final boolean STROKE
指示该形状应使用 1 像素宽的笔画进行勾画的键。

另请参见:
常量字段值

FILL

public static final boolean FILL
指示应填充该形状的键。

另请参见:
常量字段值
构造方法详细信息

ShapeGraphicAttribute

public ShapeGraphicAttribute(Shape shape,
                             int alignment,
                             boolean stroke)
针对指定 Shape 构造 ShapeGraphicAttribute

参数:
shape - 要呈现的 Shape。呈现此 Shape,其原点在宿主 TextLayout 中此 ShapeGraphicAttribute 的原点位置。此对象维护对 shape 的引用。
alignment - 此 ShapeGraphicAttribute 的对齐方式之一。
stroke - 如果要勾画 Shape,则为 true;如果要填充 Shape,则为 false
方法详细信息

getAscent

public float getAscent()
返回此 ShapeGraphicAttribute 的 ascent。ShapeGraphicAttribute 的 ascent 是从其 Shape 的原点到其 Shape 边界顶端的绝对距离。

指定者:
GraphicAttribute 中的 getAscent
返回:
ShapeGraphicAttribute 的 ascent。
另请参见:
GraphicAttribute.getBounds()

getDescent

public float getDescent()
返回此 ShapeGraphicAttribute 的 descent。ShapeGraphicAttribute 的 descent 是从其 Shape 的原点到其 Shape 边界底部的距离。

指定者:
GraphicAttribute 中的 getDescent
返回:
ShapeGraphicAttribute 的 descent。
另请参见:
GraphicAttribute.getBounds()

getAdvance

public float getAdvance()
返回此 ShapeGraphicAttribute 的 advance。ShapeGraphicAttribute 的 advance 是从其 Shape 的原点到其 Shape 边界右侧的距离。

指定者:
GraphicAttribute 中的 getAdvance
返回:
ShapeGraphicAttribute 的 advance。
另请参见:
GraphicAttribute.getBounds()

draw

public void draw(Graphics2D graphics,
                 float x,
                 float y)
在指定的位置呈现此 GraphicAttribute

指定者:
GraphicAttribute 中的 draw
参数:
graphics - 将该图形呈现到的 Graphics2D

getBounds

public Rectangle2D getBounds()
返回一个 Rectangle2D,它封装此 ShapeGraphicAttribute 相对于呈现位置绘制的所有位。图形可以呈现在其原点、ascent、descent 和 advance 之外;但如果这样做,此方法的实现应指示呈现该图形的位置。

覆盖:
GraphicAttribute 中的 getBounds
返回:
封装此 ShapeGraphicAttribute 呈现的所有位的 Rectangle2D

getOutline

public Shape getOutline(AffineTransform tx)
返回一个表示此 ShapeGraphicAttribute 呈现区域的 Shape。此方法在请求 TextLayout 返回文本轮廓时使用。该轮廓(未变换)不能扩展 getBounds 返回的矩形边界。

覆盖:
GraphicAttribute 中的 getOutline
参数:
tx - 将应用于此 ShapeGraphicAttribute 的可选 AffineTransform。该参数可以为 null。
返回:
表示此此图形属性的 Shape,适用于勾画或填充。
从以下版本开始:
1.6

hashCode

public int hashCode()
返回此 ShapeGraphicAttribute 的哈希码。

覆盖:
Object 中的 hashCode
返回:
ShapeGraphicAttribute 的哈希码值。
另请参见:
Object.equals(java.lang.Object), Hashtable

equals

public boolean equals(Object rhs)
将此 ShapeGraphicAttribute 与指定的 Object 进行比较。

覆盖:
Object 中的 equals
参数:
rhs - 比较相等性的 Object
返回:
如果此 ShapeGraphicAttribute 等于 rhs,则返回 true;否则返回 false
另请参见:
Object.hashCode(), Hashtable

equals

public boolean equals(ShapeGraphicAttribute rhs)
将此 ShapeGraphicAttribute 与指定的 ShapeGraphicAttribute 进行比较。

参数:
rhs - 要比较相等性的 ShapeGraphicAttribute
返回:
如果此 ShapeGraphicAttribute 等于 rhs,则返回 true;否则返回 false

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only