所有类


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 booleanFILL
          指示应填充该形状的键。
static booleanSTROKE
          指示该形状应使用 1 像素宽的笔画进行勾画的键。
 
从类 java.awt.font.GraphicAttribute 继承的字段
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT
 
构造方法摘要
ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke)
          为指定的 Shape 构造 ShapeGraphicAttribute
 
方法摘要
 voiddraw(Graphics2D graphics, float x, float y)
          在给定的位置绘制该图形。
 booleanequals(Object rhs)
          将此 ShapeGraphicAttribute 与指定的 Object 进行比较。
 booleanequals(ShapeGraphicAttribute rhs)
          将此 ShapeGraphicAttribute 与指定的 ShapeGraphicAttribute 进行比较。
 floatgetAdvance()
          返回此 ShapeGraphicAttribute 的 advance。
 floatgetAscent()
          返回此 ShapeGraphicAttribute 的 ascent。
 Rectangle2DgetBounds()
          返回一个 Rectangle2D,它包围了由此 ShapeGraphicAttribute 相对于呈现位置所绘制的所有位。
 floatgetDescent()
          返回此 ShapeGraphicAttribute 的 descent。
 inthashCode()
          返回此 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)
在给定的位置绘制该图形。绘制原点在 (x,y) 处的 Shape

指定者:
GraphicAttribute 中的 draw
参数:
graphics - 将该图形绘制到的 Graphics2D
x, y - 绘制该图形的用户空间坐标

getBounds

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

覆盖:
GraphicAttribute 中的 getBounds
返回:
包围由此 ShapeGraphicAttribute 呈现的所有位的 Rectangle2D

hashCode

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

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