java.lang.Object
java.awt.font.GraphicAttribute
java.awt.font.ImageGraphicAttribute
public final class ImageGraphicAttributeextends GraphicAttribute
ImageGraphicAttribute 类是在 TextLayout 中绘制图像的 GraphicAttribute 实现。
另请参见:GraphicAttribute
字段摘要
从类 java.awt.font.GraphicAttribute 继承的字段
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT
构造方法摘要
ImageGraphicAttribute(Imageimage,
intalignment)
根据指定的 Image 构造一个 ImageGraphicAttribute。
ImageGraphicAttribute(Imageimage,
intalignment,
floatoriginX,
floatoriginY)
根据指定的 Image 构造一个 ImageGraphicAttribute。
方法摘要
void
draw(Graphics2Dgraphics,
floatx,
floaty)
在指定的位置呈现该图形。
boolean
equals(ImageGraphicAttributerhs)
比较此 ImageGraphicAttribute 与指定的 ImageGraphicAttribute。
boolean
equals(Objectrhs)
比较此 ImageGraphicAttribute 与指定的 Object。
float
getAdvance()
返回此 ImageGraphicAttribute 的 advance。
float
getAscent()
返回此 ImageGraphicAttribute 的 ascent。
Rectangle2D
getBounds()
返回包括所有相对于呈现位置并且由此 ImageGraphicAttribute 呈现的所有位的 Rectangle2D。
float
getDescent()
返回此 ImageGraphicAttribute 的 descent。
int
hashCode()
返回此 ImageGraphicAttribute 的哈希码。
从类 java.awt.font.GraphicAttribute 继承的方法
getAlignment, getJustificationInfo
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
构造方法详细信息
ImageGraphicAttribute
public ImageGraphicAttribute(Imageimage,
intalignment)
根据指定的 Image 构造一个 ImageGraphicAttribute。该原点位于 (0,0)。
参数:image – 由此 ImageGraphicAttribute 呈现的 Image。此对象保存对 image 的引用。alignment – 此 ImageGraphicAttribute 的一种对齐方式。
ImageGraphicAttribute
public ImageGraphicAttribute(Imageimage,
intalignment,
floatoriginX,
floatoriginY)
根据指定的 Image 构造一个 ImageGraphicAttribute。Image 中的点 (originX,originY) 出现在文本中 ImageGraphicAttribute 的原点。
参数:image – 由此 ImageGraphicAttribute 呈现的 Image。此对象保存对 image 的引用。alignment – 此 ImageGraphicAttribute 的一种对齐方式originX,originY – Image 中点的坐标,它显示在文本行中 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()
返回包括所有相对于呈现位置并且由此 ImageGraphicAttribute 呈现的所有位的 Rectangle2D。图形可以在其原点、ascent、descent 和 advance 之外呈现;但是如果这样的话,此方法的实现必须指示呈现该图形的位置。
覆盖:类 GraphicAttribute 中的 getBounds
返回:包括由此 ImageGraphicAttribute 呈现的所有位的 Rectangle2D。
draw
public void draw(Graphics2Dgraphics,
floatx,
floaty)
在指定的位置呈现该图形。
指定者:类 GraphicAttribute 中的 draw
参数:graphics – 将该图形呈现到的 Graphics2Dx, y – 呈现该图形的用户空间坐标
hashCode
public int hashCode()
返回此 ImageGraphicAttribute 的哈希码。
覆盖:类 Object 中的 hashCode
返回:此对象的哈希码值。另请参见:Object.equals(java.lang.Object),
Hashtable
equals
public boolean equals(Objectrhs)
比较此 ImageGraphicAttribute 与指定的 Object。
覆盖:类 Object 中的 equals
参数:rhs – 要测试相等性的 Object返回:如果 ImageGraphicAttribute 与此 rhs 相等,则返回 true;否则返回 false。另请参见:Object.hashCode(),
Hashtable
equals
public boolean equals(ImageGraphicAttributerhs)
比较此 ImageGraphicAttribute 与指定的 ImageGraphicAttribute。
参数:rhs – 要测试相等性的 ImageGraphicAttribute返回:如果 ImageGraphicAttribute 与此 rhs 相等,则返回 true;否则返回 false。