- java.lang.Object
-
- java.awt.font.GraphicAttribute
-
- java.awt.font.ShapeGraphicAttribute
-
public final class ShapeGraphicAttribute extends GraphicAttribute
该ShapeGraphicAttribute类的实现GraphicAttribute绘制形状在TextLayout。- 另请参见:
-
GraphicAttribute
-
-
Field Summary
Fields Modifier and Type Field 描述 static booleanFILL一个表示形状的键应该被填充。static booleanSTROKE一个指示形状的键应该用1像素宽的笔划来抚摸。-
Fields inherited from class java.awt.font.GraphicAttribute
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT
-
-
构造方法摘要
构造方法 Constructor 描述 ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke)构造一个ShapeGraphicAttribute为指定Shape。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voiddraw(Graphics2D graphics, float x, float y)在指定的位置渲染此GraphicAttribute。booleanequals(ShapeGraphicAttribute rhs)将此ShapeGraphicAttribute与指定的ShapeGraphicAttribute。booleanequals(Object rhs)将此ShapeGraphicAttribute与指定的Object。floatgetAdvance()返回此ShapeGraphicAttribute。floatgetAscent()返回此ShapeGraphicAttribute的上升。Rectangle2DgetBounds()返回一个Rectangle2D,它包含相对于渲染位置的ShapeGraphicAttribute绘制的所有位。floatgetDescent()返回此ShapeGraphicAttribute的下降。ShapegetOutline(AffineTransform tx)返回一个Shape,表示该区域ShapeGraphicAttribute呈现。inthashCode()返回此ShapeGraphicAttribute的哈希ShapeGraphicAttribute。-
Methods inherited from class java.awt.font.GraphicAttribute
getAlignment, getJustificationInfo
-
-
-
-
字段详细信息
-
STROKE
public static final boolean STROKE
一个指示形状的键应该用1像素宽的笔划来抚摸。- 另请参见:
- Constant Field Values
-
FILL
public static final boolean FILL
一个表示形状的键应该被填充。- 另请参见:
- Constant Field Values
-
-
构造方法详细信息
-
ShapeGraphicAttribute
public ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke)
构造一个ShapeGraphicAttribute为指定Shape。- 参数
-
shape- 要呈现的Shape。Shape的原产地ShapeGraphicAttribute的主机TextLayout。 此对象维护对shape的引用。 -
alignment- 从这个ShapeGraphicAttribute一个对齐方式。 -
stroke-true如果Shape应该抚摸;false如果要填写Shape。
-
-
方法详细信息
-
getAscent
public float getAscent()
返回此ShapeGraphicAttribute的上升。 一的上升ShapeGraphicAttribute是从它的起源的正距离Shape它的边界的顶部Shape。- Specified by:
-
getAscent在GraphicAttribute - 结果
-
这个
ShapeGraphicAttribute的上升。 - 另请参见:
-
GraphicAttribute.getBounds()
-
getDescent
public float getDescent()
返回此ShapeGraphicAttribute的下降。 一个ShapeGraphicAttribute的下降是从其Shape的起点到其Shape的边界的底部的Shape。- Specified by:
-
getDescent在GraphicAttribute - 结果
-
这个
ShapeGraphicAttribute的下降。 - 另请参见:
-
GraphicAttribute.getBounds()
-
getAdvance
public float getAdvance()
返回此ShapeGraphicAttribute。 一个ShapeGraphicAttribute是从它的Shape的起源到它的Shape的边界的Shape。- Specified by:
-
getAdvance在GraphicAttribute - 结果
-
这个进步
ShapeGraphicAttribute。 - 另请参见:
-
GraphicAttribute.getBounds()
-
draw
public void draw(Graphics2D graphics, float x, float y)
在指定的位置渲染此GraphicAttribute。- Specified by:
-
draw在GraphicAttribute - 参数
-
graphics- 其中呈现图形的Graphics2D -
x- 呈现图形的用户空间X坐标 -
y- 呈现图形的用户空间Y坐标
-
getBounds
public Rectangle2D getBounds()
返回一个Rectangle2D,其中包含由该ShapeGraphicAttribute绘制的相对于呈现位置的所有位。 图形可以超出它的起源,上升,下降或提前; 但是如果这样做,则该方法的实现应该指示图形的呈现位置。- 重写:
-
getBounds在GraphicAttribute - 结果
-
一个
Rectangle2D,它包含了由这个ShapeGraphicAttribute呈现的所有位。
-
getOutline
public Shape getOutline(AffineTransform tx)
返回一个Shape,表示该区域ShapeGraphicAttribute呈现。 当请求TextLayout返回文本的大纲时使用。 (未变形)形状不得超出由getBounds返回的矩形界限getBounds。- 重写:
-
getOutline在GraphicAttribute - 参数
-
tx- 一个可选的AffineTransform适用于这个ShapeGraphicAttribute。 这可以是null。 - 结果
-
Shape代表这种图形属性,适合于抚摸或填充。 - 从以下版本开始:
- 1.6
-
hashCode
public int hashCode()
返回此ShapeGraphicAttribute的哈希ShapeGraphicAttribute。- 重写:
-
hashCode在Object - 结果
-
这个
ShapeGraphicAttribute的哈希码值。 - 另请参见:
-
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
-
equals
public boolean equals(Object rhs)
将此ShapeGraphicAttribute与指定的Object。- 重写:
-
equals在Object - 参数
-
rhs- 相对于Object进行比较 - 结果
-
true如果这个ShapeGraphicAttribute等于rhs; 否则为false。 - 另请参见:
-
Object.hashCode(),HashMap
-
equals
public boolean equals(ShapeGraphicAttribute rhs)
将此ShapeGraphicAttribute与指定的ShapeGraphicAttribute。- 参数
-
rhs-ShapeGraphicAttribute比较平等 - 结果
-
true如果这个ShapeGraphicAttribute等于rhs; 否则为false。
-
-