java.lang.Object
java.awt.font.GraphicAttribute
java.awt.font.ShapeGraphicAttribute
- 参见:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean表示应该填充形状的关键。static final boolean表示应该用1像素宽的描边绘制形状的关键。Fields declared in class java.awt.font.GraphicAttribute
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT -
Constructor Summary
ConstructorsConstructorDescriptionShapeGraphicAttribute(Shape shape, int alignment, boolean stroke) 为指定的Shape构造一个ShapeGraphicAttribute。 -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(Graphics2D graphics, float x, float y) 在指定位置渲染此GraphicAttribute。boolean将此ShapeGraphicAttribute与指定的ShapeGraphicAttribute进行比较。boolean将此ShapeGraphicAttribute与指定的Object进行比较。float返回此ShapeGraphicAttribute的前进量。float返回此ShapeGraphicAttribute的上升量。返回一个Rectangle2D,它包围了由此ShapeGraphicAttribute相对于渲染位置绘制的所有位。float返回此ShapeGraphicAttribute的下降量。返回表示此ShapeGraphicAttribute渲染区域的Shape。inthashCode()返回此ShapeGraphicAttribute的哈希码。Methods declared in class java.awt.font.GraphicAttribute
getAlignment, getJustificationInfo
-
Field Details
-
STROKE
public static final boolean STROKE表示应该用1像素宽的描边绘制形状的关键。- 参见:
-
FILL
public static final boolean FILL表示应该填充形状的关键。- 参见:
-
-
Constructor Details
-
ShapeGraphicAttribute
为指定的Shape构造一个ShapeGraphicAttribute。- 参数:
-
shape- 要渲染的Shape。Shape将以其原点位于此ShapeGraphicAttribute在主机TextLayout中的原点处。此对象保留对shape的引用。 -
alignment- 来自此ShapeGraphicAttribute的对齐方式之一。 -
stroke- 如果应该描边Shape,则为true;如果应该填充Shape,则为false。
-
-
Method Details
-
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
在指定位置渲染此GraphicAttribute。- 由以下指定:
-
draw在类GraphicAttribute中 - 参数:
-
graphics- 要渲染图形的Graphics2D -
x- 渲染图形的用户空间X坐标 -
y- 渲染图形的用户空间Y坐标
-
getBounds
返回一个Rectangle2D,它包围了由此ShapeGraphicAttribute相对于渲染位置绘制的所有位。图形可以超出其原点、上升量、下降量或前进量;但如果是这样,此方法的实现应指示图形的渲染位置。- 覆盖:
-
getBounds在类GraphicAttribute中 - 返回:
-
包围由此
ShapeGraphicAttribute渲染的所有位的Rectangle2D。
-
getOutline
- 覆盖:
-
getOutline在类GraphicAttribute中 - 参数:
-
tx- 要应用于此ShapeGraphicAttribute的可选AffineTransform。这可以为null。 - 返回:
-
表示此图形属性的
Shape,适合描边或填充。 - 自:
- 1.6
-
hashCode
public int hashCode()返回此ShapeGraphicAttribute的哈希码。 -
equals
将此ShapeGraphicAttribute与指定的Object进行比较。 -
equals
将此ShapeGraphicAttribute与指定的ShapeGraphicAttribute进行比较。- 参数:
-
rhs- 要比较相等的ShapeGraphicAttribute - 返回:
-
如果此
ShapeGraphicAttribute等于rhs,则为true;否则为false。
-