模块 java.desktop

类 ShapeGraphicAttribute

java.lang.Object
java.awt.font.GraphicAttribute
java.awt.font.ShapeGraphicAttribute

public final class ShapeGraphicAttribute extends GraphicAttribute
ShapeGraphicAttribute 类是 GraphicAttribute 的一个实现,它在 TextLayout 中绘制形状。
参见:
  • 字段详细信息

    • 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 - 要渲染的 ShapeShape 以其原点呈现在主机 TextLayout 中此 ShapeGraphicAttribute 的原点。该对象维护对 shape 的引用。
      alignment - 来自这个 ShapeGraphicAttribute 的路线之一。
      stroke - true 如果 Shape 应该被抚摸; false 如果 Shape 应该填写。
  • 方法详情

    • getAscent

      public float getAscent()
      返回此 ShapeGraphicAttribute 的上升。 ShapeGraphicAttribute 的上升是从其 Shape 的原点到其 Shape 的边界顶部的正距离。
      指定者:
      getAscent 在类 GraphicAttribute
      返回:
      这个ShapeGraphicAttribute的上升。
      参见:
    • getDescent

      public float getDescent()
      返回此 ShapeGraphicAttribute 的血统。 ShapeGraphicAttribute 的下降是从其 Shape 的原点到其 Shape 边界底部的距离。
      指定者:
      getDescent 在类 GraphicAttribute
      返回:
      这个 ShapeGraphicAttribute 的血统。
      参见:
    • getAdvance

      public float getAdvance()
      返回此 ShapeGraphicAttribute 的预付款。 ShapeGraphicAttribute 的前进是从其 Shape 的原点到其 Shape 边界右侧的距离。
      指定者:
      getAdvance 在类 GraphicAttribute
      返回:
      这个 ShapeGraphicAttribute 的进步。
      参见:
    • draw

      public void draw(Graphics2D  graphics, float x, float y)
      在指定位置呈现此 GraphicAttribute
      指定者:
      draw 在类 GraphicAttribute
      参数:
      graphics - 渲染图形的 Graphics2D
      x - 渲染图形的用户空间 X 坐标
      y - 渲染图形的用户空间 Y 坐标
    • getBounds

      public Rectangle2D  getBounds()
      返回一个 Rectangle2D ,它包含此 ShapeGraphicAttribute 相对于渲染位置绘制的所有位。图形可以在其起源、上升、下降或前进之外呈现;但如果是这样,此方法的实现应指示图形的呈现位置。
      重写:
      getBounds 在类 GraphicAttribute
      返回:
      一个 Rectangle2D 包含了这个 ShapeGraphicAttribute 呈现的所有位。
    • getOutline

      public Shape  getOutline(AffineTransform  tx)
      返回代表此 ShapeGraphicAttribute 呈现的区域的 Shape 。这在请求 TextLayout 返回文本大纲时使用。 (未转换的)形状不得延伸到 getBounds 返回的矩形边界之外。
      重写:
      getOutline 在类 GraphicAttribute
      参数:
      tx - 一个可选的 AffineTransform 应用到这个 ShapeGraphicAttribute 。这可以为空。
      返回:
      Shape 表示此图形属性,适用于描边或填充。
      自从:
      1.6
    • hashCode

      public int hashCode()
      返回此 ShapeGraphicAttribute 的哈希码。
      重写:
      hashCode 在类 Object
      返回:
      这个 ShapeGraphicAttribute 的哈希码值。
      参见:
    • equals

      public boolean equals(Object  rhs)
      将此 ShapeGraphicAttribute 与指定的 Object 进行比较。
      重写:
      equals 在类 Object
      参数:
      rhs - 比较相等的 Object
      返回:
      true 如果这个 ShapeGraphicAttribute 等于 rhsfalse否则。
      参见:
    • equals

      public boolean equals(ShapeGraphicAttribute  rhs)
      将此 ShapeGraphicAttribute 与指定的 ShapeGraphicAttribute 进行比较。
      参数:
      rhs - 要比较相等的 ShapeGraphicAttribute
      返回:
      true 如果这个 ShapeGraphicAttribute 等于 rhsfalse否则。