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

ConstructorDescription
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

MethodDescription
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:

ParameterTypeDescription
textjava.lang.StringThe text to draw.
rectangleRectangleFThe text rectangle.
fontFontThe font to use.
stringFormatStringFormatThe 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:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valueFont

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:

ParameterTypeDescription
valueStringFormat

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:

ParameterTypeDescription
matrixMatrixThe 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:

ParameterTypeDescription
matrixMatrixThe matrix to apply before bounds will be calculated.
penPenThe 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:

ParameterTypeDescription
transformMatrixThe transformation to apply.

equals(Object o)

public boolean equals(Object o)

Check if objects are equal.

Parameters:

ParameterTypeDescription
ojava.lang.ObjectThe other object.

Returns: boolean - The equality comparison result.

hashCode()

public int hashCode()

Get hash code of the current object.

Returns: int - The hash code.