TextShape
Inheritance: java.lang.Object, com.aspose.imaging.ObjectWithBounds, com.aspose.imaging.Shape, com.aspose.imaging.shapes.RectangleProjectedShape
public final class TextShape extends RectangleProjectedShape
表示文本形状。
构造函数
| 构造函数 | 描述 |
|---|---|
| TextShape() | 初始化 TextShape 类的新实例。 |
| TextShape(String text, RectangleF rectangle, Font font, StringFormat stringFormat) | 初始化 TextShape 类的新实例。 |
方法
| 方法 | 描述 |
|---|---|
| getText() | 获取或设置绘制的文本。 |
| setText(String value) | 获取或设置绘制的文本。 |
| getFont() | 获取或设置用于绘制文本的字体。 |
| setFont(Font value) | 获取或设置用于绘制文本的字体。 |
| getTextFormat() | 获取或设置文本格式。 |
| setTextFormat(StringFormat value) | 获取或设置文本格式。 |
| getCenter() | 获取形状的中心。 |
| getBounds() | 获取对象的边界。 |
| getSegments() | 获取形状的段。 |
| hasSegments() | 获取指示形状是否具有段的值。 |
| getBounds(Matrix matrix) | 获取对象的边界。 |
| getBounds(Matrix matrix, Pen pen) | 获取对象的边界。 |
| transform(Matrix transform) | 对形状应用指定的变换。 |
| equals(Object o) | 检查对象是否相等。 |
| hashCode() | 获取当前对象的哈希码。 |
TextShape()
public TextShape()
初始化 TextShape 类的新实例。
TextShape(String text, RectangleF rectangle, Font font, StringFormat stringFormat)
public TextShape(String text, RectangleF rectangle, Font font, StringFormat stringFormat)
初始化 TextShape 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| text | java.lang.String | 要绘制的文本。 |
| rectangle | RectangleF | 文本矩形。 |
| font | Font | 要使用的字体。 |
| stringFormat | StringFormat | 字符串格式。 |
getText()
public String getText()
获取或设置绘制的文本。
值:绘制的文本。
Returns: java.lang.String
setText(String value)
public void setText(String value)
获取或设置绘制的文本。
值:绘制的文本。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | java.lang.String |
getFont()
public Font getFont()
获取或设置用于绘制文本的字体。
值:用于绘制文本的字体。
Returns: Font
setFont(Font value)
public void setFont(Font value)
获取或设置用于绘制文本的字体。
值:用于绘制文本的字体。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | Font |
getTextFormat()
public StringFormat getTextFormat()
获取或设置文本格式。
值:文本格式。
Returns: StringFormat
setTextFormat(StringFormat value)
public void setTextFormat(StringFormat value)
获取或设置文本格式。
值:文本格式。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | StringFormat |
getCenter()
public PointF getCenter()
获取形状的中心。
值:形状的中心。
Returns: PointF
getBounds()
public RectangleF getBounds()
获取对象的边界。
值:对象的边界。
Returns: RectangleF
getSegments()
public ShapeSegment[] getSegments()
获取形状的段。
值:形状段。
Returns: com.aspose.imaging.ShapeSegment[]
hasSegments()
public boolean hasSegments()
获取指示形状是否具有段的值。
值:如果形状有段,则为 True;否则为 false。
Returns: boolean
getBounds(Matrix matrix)
public RectangleF getBounds(Matrix matrix)
获取对象的边界。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| matrix | Matrix | 在计算边界之前要应用的矩阵。 |
Returns: RectangleF - The estimated object’s bounds.
getBounds(Matrix matrix, Pen pen)
public RectangleF getBounds(Matrix matrix, Pen pen)
获取对象的边界。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| matrix | Matrix | 在计算边界之前要应用的矩阵。 |
| pen | Pen | 用于对象的笔。它可能影响对象的边界尺寸。 |
Returns: RectangleF - The estimated object’s bounds.
transform(Matrix transform)
public void transform(Matrix transform)
对形状应用指定的变换。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| transform | Matrix | 要应用的转换。 |
equals(Object o)
public boolean equals(Object o)
检查对象是否相等。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| o | java.lang.Object | 其他对象。 |
Returns: boolean - 相等比较结果。
hashCode()
public int hashCode()
获取当前对象的哈希码。
Returns: int - 哈希码。