Class Text.SingleLine
- java.lang.Object
-
- ch.andre601.fluxpoint4j.image.format.Text
-
- ch.andre601.fluxpoint4j.image.format.Text.SingleLine
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ch.andre601.fluxpoint4j.image.format.Text
Text.MultiLine, Text.SingleLine, Text.TextAlignment
-
-
Constructor Summary
Constructors Constructor Description SingleLine(@NotNull java.lang.String line)
Creates a new SingleLine instance to use with the provided String as the displayed text value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Text.SingleLine
asBold(boolean bold)
Sets whether the text should be bold or not.Text.SingleLine
asItalic(boolean italic)
Sets whether the text should be italic or not.Text.SingleLine
asUnderline(boolean underline)
Sets whether the text should be underlined or not.Text.SingleLine
withBackgroundColor(@NotNull ColorObject backgroundColor)
Sets the background color to use for the Text.Text.SingleLine
withColor(@NotNull ColorObject color)
Sets the Text color to use.Text.SingleLine
withFont(@NotNull java.lang.String font)
Sets the font to use for the text.Text.SingleLine
withMaxHeight(int maxHeight)
Sets the maximum height the text should take.Text.SingleLine
withMaxWidth(int maxWidth)
Sets the maximum width the text should take.Text.SingleLine
withOutline(boolean outline)
Sets whether the text should have an outline or not.Text.SingleLine
withOutlineBlur(int outlineBlur)
Sets the blur the outline should have.Text.SingleLine
withOutlineColor(@NotNull ColorObject color)
Sets the outline color to use.Text.SingleLine
withOutlineWidth(int outlineWidth)
Sets the width of the outline for the text.Text.SingleLine
withPosX(int posX)
Sets the relative X (horizontal) position of the text, where 0 is the very left of the image.Text.SingleLine
withPosY(int posY)
Sets the relative Y (vertical) position of the text, where 0 is the very top of the image.Text.SingleLine
withSize(int size)
Sets the text size to use.Text.SingleLine
withTextAlignment(@NotNull Text.TextAlignment textAlignment)
Sets the text-alignment this text has using the providedTextAlignment value
.Text.SingleLine
withWeight(int weight)
Sets the font weight of this text.
-
-
-
Method Detail
-
withPosX
public Text.SingleLine withPosX(int posX)
Sets the relative X (horizontal) position of the text, where 0 is the very left of the image.
The value can be between 0 andInteger.MAX_VALUE
(2147483647)An
IllegalArgumentException
may be thrown in the following case:- PosX is less than 0.
-
withPosY
public Text.SingleLine withPosY(int posY)
Sets the relative Y (vertical) position of the text, where 0 is the very top of the image.
The value can be between 0 andInteger.MAX_VALUE
(2147483647)An
IllegalArgumentException
may be thrown in the following case:- PosX is less than 0.
-
withTextAlignment
public Text.SingleLine withTextAlignment(@NotNull @NotNull Text.TextAlignment textAlignment)
Sets the text-alignment this text has using the providedTextAlignment value
.
The text-alignment influences how the Text is positioned horizontally when usingwithPosX(int)
.- Specified by:
withTextAlignment
in classText
- Parameters:
textAlignment
- The Text-alignment to use for this text.- Returns:
- The SingleLine instance. Useful for chaining.
-
withSize
public Text.SingleLine withSize(int size)
Sets the text size to use.An
IllegalArgumentException
may be thrown in the following case:- Size is 0 or less.
-
withFont
public Text.SingleLine withFont(@NotNull @NotNull java.lang.String font)
Sets the font to use for the text.
Whether the provided font is valid and/or usable by the API depends on the Fluxpoint API itself and is nothing that can be checked in this library.An
IllegalArgumentException
may be thrown in the following case:- Font is an empty String.
-
withColor
public Text.SingleLine withColor(@NotNull @NotNull ColorObject color)
Sets the Text color to use.
Please see the documentation of theColorObject
for possible errors.
-
withBackgroundColor
public Text.SingleLine withBackgroundColor(@NotNull @NotNull ColorObject backgroundColor)
Sets the background color to use for the Text.
Please see the documentation of theColorObject
for possible errors.- Specified by:
withBackgroundColor
in classText
- Parameters:
backgroundColor
- The color to use for the text-background.- Returns:
- The SingleLine instance. Useful for chaining.
-
asBold
public Text.SingleLine asBold(boolean bold)
Sets whether the text should be bold or not.
-
asItalic
public Text.SingleLine asItalic(boolean italic)
Sets whether the text should be italic or not.
-
asUnderline
public Text.SingleLine asUnderline(boolean underline)
Sets whether the text should be underlined or not.- Specified by:
asUnderline
in classText
- Parameters:
underline
- Boolean to set if the text should be underlined or not.- Returns:
- The SingleLine instance. Useful for chaining.
-
withWeight
public Text.SingleLine withWeight(int weight)
Sets the font weight of this text.
The value can be between 0 andInteger.MAX_VALUE
(2147483647) where 0 would essentially hide the text.An
IllegalArgumentException
may be thrown in the following case:- Weight is less than 0.
- Specified by:
withWeight
in classText
- Parameters:
weight
- The font weight to use.- Returns:
- The SingleLine instance. Useful for chaining.
-
withMaxWidth
public Text.SingleLine withMaxWidth(int maxWidth)
Sets the maximum width the text should take.
The value can be between 0 andInteger.MAX_VALUE
(2147483647) where 0 would essentially hide the text.An
IllegalArgumentException
may be thrown in the following case:- MaxWidth is less than 0.
- Specified by:
withMaxWidth
in classText
- Parameters:
maxWidth
- The maximum width of the text.- Returns:
- The SingleLine instance. Useful for chaining.
-
withMaxHeight
public Text.SingleLine withMaxHeight(int maxHeight)
Sets the maximum height the text should take.
The value can be between 0 andInteger.MAX_VALUE
(2147483647) where 0 would essentially hide the text.An
IllegalArgumentException
may be thrown in the following case:- MaxHeight is less than 0.
- Specified by:
withMaxHeight
in classText
- Parameters:
maxHeight
- The maximum height of the text.- Returns:
- The SingleLine instance. Useful for chaining.
-
withOutline
public Text.SingleLine withOutline(boolean outline)
Sets whether the text should have an outline or not.- Specified by:
withOutline
in classText
- Parameters:
outline
- Boolean to set if the text should have an outline.- Returns:
- The SingleLine instance. Useful for chaining.
-
withOutlineWidth
public Text.SingleLine withOutlineWidth(int outlineWidth)
Sets the width of the outline for the text.
This has no effect ifwithOutline(false)
(default value) is used.The value can be between 0 and
Integer.MAX_VALUE
(2147483647) where 0 would make the text have no outline.An
IllegalArgumentException
may be thrown in the following case:- OutlineWidth is less than 0.
- Specified by:
withOutlineWidth
in classText
- Parameters:
outlineWidth
- The width the outline should have.- Returns:
- The SingleLine instance. Useful for chaining.
-
withOutlineColor
public Text.SingleLine withOutlineColor(@NotNull @NotNull ColorObject color)
Sets the outline color to use.
This has no effect ifwithOutline(false)
(default value) is used.Please see the documentation of the
ColorObject
for possible errors.- Specified by:
withOutlineColor
in classText
- Parameters:
color
- The color to use for the outline.- Returns:
- The SingleLine instance. Useful for chaining.
-
withOutlineBlur
public Text.SingleLine withOutlineBlur(int outlineBlur)
Sets the blur the outline should have.
This has no effect ifwithOutline(false)
(default value) is used.The value can be between 0 and
Integer.MAX_VALUE
(2147483647) where 0 would make the text have no outline blurring.An
IllegalArgumentException
may be thrown in the following case:- OutlineWidth is less than 0.
- Specified by:
withOutlineBlur
in classText
- Parameters:
outlineBlur
- The strength of the blurring for the outline.- Returns:
- The SingleLine instance. Useful for chaining.
-
-