TextShape
Inheritance: java.lang.Object, com.aspose.imaging.ObjectWithBounds, com.aspose.imaging.Shape, com.aspose.imaging.shapes.RectangleProjectedShape
public final class TextShape extends RectangleProjectedShape
Represents a text shape.
Constructors
| Constructor | Description |
|---|---|
| TextShape() | Initializes a new instance of the TextShape class. |
| TextShape(String text, RectangleF rectangle, Font font, StringFormat stringFormat) | Initializes a new instance of the TextShape class. |
Methods
| Method | Description |
|---|---|
| getText() | Gets or sets the drawn text. |
| setText(String value) | Gets or sets the drawn text. |
| getFont() | Gets or sets the font used to draw the text. |
| setFont(Font value) | Gets or sets the font used to draw the text. |
| getTextFormat() | Gets or sets the text format. |
| setTextFormat(StringFormat value) | Gets or sets the text format. |
| getCenter() | Gets the shape’s center. |
| getBounds() | Gets the object’s bounds. |
| getSegments() | Gets the shape segments. |
| hasSegments() | Gets a value indicating whether shape has segments. |
| getBounds(Matrix matrix) | Gets the object’s bounds. |
| getBounds(Matrix matrix, Pen pen) | Gets the object’s bounds. |
| transform(Matrix transform) | Applies the specified transformation to the shape. |
| equals(Object o) | Check if objects are equal. |
| hashCode() | Get hash code of the current object. |
TextShape()
public TextShape()
Initializes a new instance of the TextShape class.
TextShape(String text, RectangleF rectangle, Font font, StringFormat stringFormat)
public TextShape(String text, RectangleF rectangle, Font font, StringFormat stringFormat)
Initializes a new instance of the TextShape class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| text | java.lang.String | The text to draw. |
| rectangle | RectangleF | The text rectangle. |
| font | Font | The font to use. |
| stringFormat | StringFormat | The string format. |
getText()
public String getText()
Gets or sets the drawn text.
Value: The drawn text.
Returns: java.lang.String
setText(String value)
public void setText(String value)
Gets or sets the drawn text.
Value: The drawn text.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | java.lang.String |
getFont()
public Font getFont()
Gets or sets the font used to draw the text.
Value: The font used to draw the text.
Returns: Font
setFont(Font value)
public void setFont(Font value)
Gets or sets the font used to draw the text.
Value: The font used to draw the text.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | Font |
getTextFormat()
public StringFormat getTextFormat()
Gets or sets the text format.
Value: The text format.
Returns: StringFormat
setTextFormat(StringFormat value)
public void setTextFormat(StringFormat value)
Gets or sets the text format.
Value: The text format.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | StringFormat |
getCenter()
public PointF getCenter()
Gets the shape’s center.
Value: The shape’s center.
Returns: PointF
getBounds()
public RectangleF getBounds()
Gets the object’s bounds.
Value: The object’s bounds.
Returns: RectangleF
getSegments()
public ShapeSegment[] getSegments()
Gets the shape segments.
Value: The shape segments.
Returns: com.aspose.imaging.ShapeSegment[]
hasSegments()
public boolean hasSegments()
Gets a value indicating whether shape has segments.
Value: True if shape has segments; otherwise, false.
Returns: boolean
getBounds(Matrix matrix)
public RectangleF getBounds(Matrix matrix)
Gets the object’s bounds.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| matrix | Matrix | The matrix to apply before bounds will be calculated. |
Returns: RectangleF - The estimated object’s bounds.
getBounds(Matrix matrix, Pen pen)
public RectangleF getBounds(Matrix matrix, Pen pen)
Gets the object’s bounds.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| matrix | Matrix | The matrix to apply before bounds will be calculated. |
| pen | Pen | The pen to use for object. This can influence the object’s bounds size. |
Returns: RectangleF - The estimated object’s bounds.
transform(Matrix transform)
public void transform(Matrix transform)
Applies the specified transformation to the shape.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| transform | Matrix | The transformation to apply. |
equals(Object o)
public boolean equals(Object o)
Check if objects are equal.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| o | java.lang.Object | The other object. |
Returns: boolean - The equality comparison result.
hashCode()
public int hashCode()
Get hash code of the current object.
Returns: int - The hash code.