JavaTM Platform
Standard Ed. 6

java.awt.font
类 ImageGraphicAttribute

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

public final class ImageGraphicAttribute
extends GraphicAttribute

ImageGraphicAttribute 类是在 TextLayout 中绘制图像的 GraphicAttribute 实现。

另请参见:
GraphicAttribute

字段摘要
 
从类 java.awt.font.GraphicAttribute 继承的字段
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT
 
构造方法摘要
ImageGraphicAttribute(Image image, int alignment)
          根据指定的 Image 构造一个 ImageGraphicAttribute
ImageGraphicAttribute(Image image, int alignment, float originX, float originY)
          根据指定的 Image 构造一个 ImageGraphicAttribute
 
方法摘要
 void draw(Graphics2D graphics, float x, float y)
          在指定的位置呈现此 GraphicAttribute
 boolean equals(ImageGraphicAttribute rhs)
          比较此 ImageGraphicAttribute 与指定的 ImageGraphicAttribute
 boolean equals(Object rhs)
          比较此 ImageGraphicAttribute 与指定的 Object
 float getAdvance()
          返回此 ImageGraphicAttribute 的 advance。
 float getAscent()
          返回此 ImageGraphicAttribute 的 ascent。
 Rectangle2D getBounds()
          返回一个 Rectangle2D,它封装此 ImageGraphicAttribute 相对于呈现位置呈现的所有位。
 float getDescent()
          返回此 ImageGraphicAttribute 的 descent。
 int hashCode()
          返回此 ImageGraphicAttribute 的哈希码。
 
从类 java.awt.font.GraphicAttribute 继承的方法
getAlignment, getJustificationInfo, getOutline
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ImageGraphicAttribute

public ImageGraphicAttribute(Image image,
                             int alignment)
根据指定的 Image 构造一个 ImageGraphicAttribute。原点位于 (0, 0)。

参数:
image - 此 ImageGraphicAttribute 呈现的 Image。此对象保持对 image 的引用。
alignment - 此 ImageGraphicAttribute 的一种对齐方式。

ImageGraphicAttribute

public ImageGraphicAttribute(Image image,
                             int alignment,
                             float originX,
                             float originY)
根据指定的 Image 构造一个 ImageGraphicAttributeImage 中的点 (originXoriginY) 出现在文本中 ImageGraphicAttribute 的原点。

参数:
image - 此 ImageGraphicAttribute 呈现的 Image。此对象保持对 image 的引用。
alignment - 此 ImageGraphicAttribute 的一种对齐方式
originX - Image 中点的 X 坐标,该点显示在文本行中 ImageGraphicAttribute 的原点位置上。
originY - Image 中点的 Y 坐标,该点显示在文本行中 ImageGraphicAttribute 的原点位置上。
方法详细信息

getAscent

public float getAscent()
返回此 ImageGraphicAttribute 的 ascent。ImageGraphicAttribute 的 ascent 是从该图像的顶端到原点的距离。

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

getDescent

public float getDescent()
返回此 ImageGraphicAttribute 的 descent。ImageGraphicAttribute 的 descent 是从原点到该图像底部的距离。

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

getAdvance

public float getAdvance()
返回此 ImageGraphicAttribute 的 advance。ImageGraphicAttribute 的 advance 是从原点到该图像右边缘的距离。

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

getBounds

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

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

draw

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

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

hashCode

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

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

equals

public boolean equals(Object rhs)
比较此 ImageGraphicAttribute 与指定的 Object

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

equals

public boolean equals(ImageGraphicAttribute rhs)
比较此 ImageGraphicAttribute 与指定的 ImageGraphicAttribute

参数:
rhs - 要测试相等性的 ImageGraphicAttribute
返回:
如果此 ImageGraphicAttributerhs 相等,则返回 true;否则返回 false

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策