StyleSet<TextGraphics>
, TextGraphics
, ThemedTextGraphics
, TextGUIGraphics
public class DefaultTextGUIGraphics extends Object implements TextGUIGraphics
StyleSet.Set
Modifier and Type | Method | Description |
---|---|---|
DefaultTextGUIGraphics |
applyThemeStyle(ThemeStyle themeStyle) |
Takes a ThemeStyle as applies it to this TextGraphics.
|
DefaultTextGUIGraphics |
clearModifiers() |
Removes all active modifiers
|
DefaultTextGUIGraphics |
disableModifiers(SGR... modifiers) |
Removes zero or more modifiers from the set of currently active modifiers
|
DefaultTextGUIGraphics |
drawImage(TerminalPosition topLeft,
TextImage image) |
Takes a TextImage and draws it on the surface this TextGraphics is targeting, given the coordinates on the target
that is specifying where the top-left corner of the image should be drawn.
|
DefaultTextGUIGraphics |
drawImage(TerminalPosition topLeft,
TextImage image,
TerminalPosition sourceImageTopLeft,
TerminalSize sourceImageSize) |
Takes a TextImage and draws it on the surface this TextGraphics is targeting, given the coordinates on the target
that is specifying where the top-left corner of the image should be drawn.
|
DefaultTextGUIGraphics |
drawLine(int fromX,
int fromY,
int toX,
int toY,
char character) |
Draws a line from a specified position to a specified position, using a supplied character.
|
DefaultTextGUIGraphics |
drawLine(int fromX,
int fromY,
int toX,
int toY,
TextCharacter character) |
Draws a line from a specified position to a specified position, using a supplied character.
|
DefaultTextGUIGraphics |
drawLine(TerminalPosition fromPoint,
TerminalPosition toPoint,
char character) |
Draws a line from a specified position to a specified position, using a supplied character.
|
DefaultTextGUIGraphics |
drawLine(TerminalPosition fromPoint,
TerminalPosition toPoint,
TextCharacter character) |
Draws a line from a specified position to a specified position, using a supplied TextCharacter.
|
DefaultTextGUIGraphics |
drawRectangle(TerminalPosition topLeft,
TerminalSize size,
char character) |
Draws the outline of a rectangle with a particular character (and the currently active colors and
modifiers).
|
DefaultTextGUIGraphics |
drawRectangle(TerminalPosition topLeft,
TerminalSize size,
TextCharacter character) |
Draws the outline of a rectangle with a particular TextCharacter, ignoring the current colors and modifiers of
this TextGraphics.
|
DefaultTextGUIGraphics |
drawTriangle(TerminalPosition p1,
TerminalPosition p2,
TerminalPosition p3,
char character) |
Draws the outline of a triangle on the screen, using a supplied character.
|
DefaultTextGUIGraphics |
drawTriangle(TerminalPosition p1,
TerminalPosition p2,
TerminalPosition p3,
TextCharacter character) |
Draws the outline of a triangle on the screen, using a supplied character.
|
DefaultTextGUIGraphics |
enableModifiers(SGR... modifiers) |
Adds zero or more modifiers to the set of currently active modifiers
|
DefaultTextGUIGraphics |
fill(char c) |
Fills the entire writable area with a single character, using current foreground color, background color and modifiers.
|
DefaultTextGUIGraphics |
fillRectangle(TerminalPosition topLeft,
TerminalSize size,
char character) |
Takes a rectangle and fills it with a particular character (and the currently active colors and
modifiers).
|
DefaultTextGUIGraphics |
fillRectangle(TerminalPosition topLeft,
TerminalSize size,
TextCharacter character) |
Takes a rectangle and fills it using a particular TextCharacter, ignoring the current colors and modifiers of
this TextGraphics.
|
DefaultTextGUIGraphics |
fillTriangle(TerminalPosition p1,
TerminalPosition p2,
TerminalPosition p3,
char character) |
Draws a filled triangle, using a supplied character.
|
DefaultTextGUIGraphics |
fillTriangle(TerminalPosition p1,
TerminalPosition p2,
TerminalPosition p3,
TextCharacter character) |
Draws a filled triangle, using a supplied character.
|
EnumSet<SGR> |
getActiveModifiers() |
Returns all the SGR codes that are currently active
|
TextColor |
getBackgroundColor() |
Returns the current background color
|
TextCharacter |
getCharacter(int column,
int row) |
Returns the character at the specific position in the terminal.
|
TextCharacter |
getCharacter(TerminalPosition position) |
Returns the character at the specific position in the terminal.
|
TextColor |
getForegroundColor() |
Returns the current foreground color
|
TerminalSize |
getSize() |
Returns the size of the area that this text graphic can write to.
|
TabBehaviour |
getTabBehaviour() |
Retrieves the current tab behaviour, which is what the TextGraphics will use when expanding \t characters to
spaces.
|
TextGUI |
getTextGUI() |
Returns the
TextGUI this TextGUIGraphics belongs to |
DefaultTextGUIGraphics |
newTextGraphics(TerminalPosition topLeftCorner,
TerminalSize size) |
Creates a new TextGraphics of the same type as this one, using the same underlying subsystem.
|
DefaultTextGUIGraphics |
putCSIStyledString(int column,
int row,
String string) |
Puts a string on the screen at the specified position with the current colors and modifiers.
|
DefaultTextGUIGraphics |
putCSIStyledString(TerminalPosition position,
String string) |
Puts a string on the screen at the specified position with the current colors and modifiers.
|
DefaultTextGUIGraphics |
putString(int column,
int row,
String string) |
Puts a string on the screen at the specified position with the current colors and modifiers.
|
DefaultTextGUIGraphics |
putString(int column,
int row,
String string,
SGR extraModifier,
SGR... optionalExtraModifiers) |
Puts a string on the screen at the specified position with the current colors and modifiers.
|
DefaultTextGUIGraphics |
putString(int column,
int row,
String string,
Collection<SGR> extraModifiers) |
Puts a string on the screen at the specified position with the current colors and modifiers.
|
DefaultTextGUIGraphics |
putString(TerminalPosition position,
String string) |
Shortcut to calling:
|
DefaultTextGUIGraphics |
putString(TerminalPosition position,
String string,
SGR extraModifier,
SGR... optionalExtraModifiers) |
Shortcut to calling:
|
DefaultTextGUIGraphics |
setBackgroundColor(TextColor backgroundColor) |
Updates the current background color
|
DefaultTextGUIGraphics |
setCharacter(int column,
int row,
char character) |
Sets the character at the current position to the specified value
|
DefaultTextGUIGraphics |
setCharacter(int column,
int row,
TextCharacter character) |
Sets the character at the current position to the specified value, without using the current colors and modifiers
of this TextGraphics.
|
DefaultTextGUIGraphics |
setCharacter(TerminalPosition position,
char character) |
Sets the character at the current position to the specified value
|
DefaultTextGUIGraphics |
setCharacter(TerminalPosition position,
TextCharacter character) |
Sets the character at the current position to the specified value, without using the current colors and modifiers
of this TextGraphics.
|
DefaultTextGUIGraphics |
setForegroundColor(TextColor foregroundColor) |
Updates the current foreground color
|
DefaultTextGUIGraphics |
setModifiers(EnumSet<SGR> modifiers) |
Sets the active modifiers to exactly the set passed in to this method.
|
DefaultTextGUIGraphics |
setStyleFrom(StyleSet<?> source) |
copy colors and set of SGR codes
|
DefaultTextGUIGraphics |
setTabBehaviour(TabBehaviour tabBehaviour) |
Sets the behaviour to use when expanding tab characters (\t) to spaces
|
public TextGUI getTextGUI()
TextGUIGraphics
TextGUI
this TextGUIGraphics
belongs togetTextGUI
in interface TextGUIGraphics
TextGUI
this TextGUIGraphics
belongs topublic DefaultTextGUIGraphics newTextGraphics(TerminalPosition topLeftCorner, TerminalSize size) throws IllegalArgumentException
TextGraphics
newTextGraphics(TerminalPosition.TOP_LEFT_CORNER, textGraphics.getSize())
then the resulting object will be identical to this one, but having a separated state for colors, position and
modifiers.newTextGraphics
in interface TextGraphics
newTextGraphics
in interface TextGUIGraphics
topLeftCorner
- Position of this TextGraphics's writable area that is to become the top-left corner (0x0) of
the new TextGraphicssize
- How large area, counted from the topLeftCorner, the new TextGraphics can write to. This cannot be
larger than the current TextGraphics's writable area (adjusted by topLeftCorner)IllegalArgumentException
- If the size the of new TextGraphics exceeds the dimensions of this
TextGraphics in any way.public DefaultTextGUIGraphics applyThemeStyle(ThemeStyle themeStyle)
ThemedTextGraphics
applyThemeStyle
in interface TextGUIGraphics
applyThemeStyle
in interface ThemedTextGraphics
themeStyle
- ThemeStyle to applypublic TerminalSize getSize()
TextGraphics
getSize
in interface TextGraphics
public TextColor getBackgroundColor()
StyleSet
getBackgroundColor
in interface StyleSet<TextGraphics>
public DefaultTextGUIGraphics setBackgroundColor(TextColor backgroundColor)
StyleSet
setBackgroundColor
in interface StyleSet<TextGraphics>
setBackgroundColor
in interface TextGUIGraphics
backgroundColor
- New background colorpublic TextColor getForegroundColor()
StyleSet
getForegroundColor
in interface StyleSet<TextGraphics>
public DefaultTextGUIGraphics setForegroundColor(TextColor foregroundColor)
StyleSet
setForegroundColor
in interface StyleSet<TextGraphics>
setForegroundColor
in interface TextGUIGraphics
foregroundColor
- New foreground colorpublic DefaultTextGUIGraphics enableModifiers(SGR... modifiers)
StyleSet
enableModifiers
in interface StyleSet<TextGraphics>
enableModifiers
in interface TextGUIGraphics
modifiers
- Modifiers to add to the set of currently active modifierspublic DefaultTextGUIGraphics disableModifiers(SGR... modifiers)
StyleSet
disableModifiers
in interface StyleSet<TextGraphics>
disableModifiers
in interface TextGUIGraphics
modifiers
- Modifiers to remove from the set of currently active modifierspublic DefaultTextGUIGraphics setModifiers(EnumSet<SGR> modifiers)
StyleSet
setModifiers
in interface StyleSet<TextGraphics>
setModifiers
in interface TextGUIGraphics
modifiers
- Modifiers to set as activepublic DefaultTextGUIGraphics clearModifiers()
StyleSet
clearModifiers
in interface StyleSet<TextGraphics>
clearModifiers
in interface TextGUIGraphics
public EnumSet<SGR> getActiveModifiers()
StyleSet
getActiveModifiers
in interface StyleSet<TextGraphics>
public TabBehaviour getTabBehaviour()
TextGraphics
getTabBehaviour
in interface TextGraphics
public DefaultTextGUIGraphics setTabBehaviour(TabBehaviour tabBehaviour)
TextGraphics
setTabBehaviour
in interface TextGraphics
setTabBehaviour
in interface TextGUIGraphics
tabBehaviour
- Behaviour to use when expanding tabs to spacespublic DefaultTextGUIGraphics fill(char c)
TextGraphics
fill
in interface TextGraphics
fill
in interface TextGUIGraphics
c
- Character to fill the writable area withpublic DefaultTextGUIGraphics fillRectangle(TerminalPosition topLeft, TerminalSize size, char character)
TextGraphics
For example, calling fillRectangle with size being the size of the terminal and top-left value being the terminal's top-left (0x0) corner will fill the entire terminal with this character.
The current foreground color, background color and modifiers will be applied.
fillRectangle
in interface TextGraphics
fillRectangle
in interface TextGUIGraphics
topLeft
- Coordinates of the top-left position of the rectanglesize
- Size (in columns and rows) of the area to drawcharacter
- What character to use when filling the rectanglepublic DefaultTextGUIGraphics fillRectangle(TerminalPosition topLeft, TerminalSize size, TextCharacter character)
TextGraphics
For example, calling fillRectangle with size being the size of the terminal and top-left value being the terminal's top-left (0x0) corner will fill the entire terminal with this character.
The current foreground color, background color and modifiers will not be modified by this call.
fillRectangle
in interface TextGraphics
fillRectangle
in interface TextGUIGraphics
topLeft
- Coordinates of the top-left position of the rectanglesize
- Size (in columns and rows) of the area to drawcharacter
- What character data to use when filling the rectanglepublic DefaultTextGUIGraphics drawRectangle(TerminalPosition topLeft, TerminalSize size, char character)
TextGraphics
For example, calling drawRectangle with size being the size of the terminal and top-left value being the terminal's top-left (0x0) corner will draw a border around the terminal.
The current foreground color, background color and modifiers will be applied.
drawRectangle
in interface TextGraphics
drawRectangle
in interface TextGUIGraphics
topLeft
- Coordinates of the top-left position of the rectanglesize
- Size (in columns and rows) of the area to drawcharacter
- What character to use when drawing the outline of the rectanglepublic DefaultTextGUIGraphics drawRectangle(TerminalPosition topLeft, TerminalSize size, TextCharacter character)
TextGraphics
For example, calling drawRectangle with size being the size of the terminal and top-left value being the terminal's top-left (0x0) corner will draw a border around the terminal.
The current foreground color, background color and modifiers will not be modified by this call.
drawRectangle
in interface TextGraphics
drawRectangle
in interface TextGUIGraphics
topLeft
- Coordinates of the top-left position of the rectanglesize
- Size (in columns and rows) of the area to drawcharacter
- What character data to use when drawing the outline of the rectanglepublic DefaultTextGUIGraphics fillTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, char character)
TextGraphics
fillTriangle
in interface TextGraphics
fillTriangle
in interface TextGUIGraphics
p1
- First point on the screen of the trianglep2
- Second point on the screen of the trianglep3
- Third point on the screen of the trianglecharacter
- What character to use when drawing the trianglepublic DefaultTextGUIGraphics fillTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, TextCharacter character)
TextGraphics
fillTriangle
in interface TextGraphics
fillTriangle
in interface TextGUIGraphics
p1
- First point on the screen of the trianglep2
- Second point on the screen of the trianglep3
- Third point on the screen of the trianglecharacter
- What character data to use when drawing the trianglepublic DefaultTextGUIGraphics drawTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, char character)
TextGraphics
drawTriangle
in interface TextGraphics
drawTriangle
in interface TextGUIGraphics
p1
- First point on the screen of the trianglep2
- Second point on the screen of the trianglep3
- Third point on the screen of the trianglecharacter
- What character to use when drawing the lines of the trianglepublic DefaultTextGUIGraphics drawTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, TextCharacter character)
TextGraphics
drawTriangle
in interface TextGraphics
drawTriangle
in interface TextGUIGraphics
p1
- First point on the screen of the trianglep2
- Second point on the screen of the trianglep3
- Third point on the screen of the trianglecharacter
- What character data to use when drawing the lines of the trianglepublic DefaultTextGUIGraphics drawLine(TerminalPosition fromPoint, TerminalPosition toPoint, char character)
TextGraphics
drawLine
in interface TextGraphics
drawLine
in interface TextGUIGraphics
fromPoint
- From where to draw the linetoPoint
- Where to draw the linecharacter
- Character to use for the linepublic DefaultTextGUIGraphics drawLine(TerminalPosition fromPoint, TerminalPosition toPoint, TextCharacter character)
TextGraphics
drawLine
in interface TextGraphics
drawLine
in interface TextGUIGraphics
fromPoint
- From where to draw the linetoPoint
- Where to draw the linecharacter
- Character data to use for the line, including character, colors and modifierspublic DefaultTextGUIGraphics drawLine(int fromX, int fromY, int toX, int toY, char character)
TextGraphics
drawLine
in interface TextGraphics
drawLine
in interface TextGUIGraphics
fromX
- Column of the starting position to draw the line from (inclusive)fromY
- Row of the starting position to draw the line from (inclusive)toX
- Column of the end position to draw the line to (inclusive)toY
- Row of the end position to draw the line to (inclusive)character
- Character to use for the linepublic DefaultTextGUIGraphics drawLine(int fromX, int fromY, int toX, int toY, TextCharacter character)
TextGraphics
drawLine
in interface TextGraphics
drawLine
in interface TextGUIGraphics
fromX
- Column of the starting position to draw the line from (inclusive)fromY
- Row of the starting position to draw the line from (inclusive)toX
- Column of the end position to draw the line to (inclusive)toY
- Row of the end position to draw the line to (inclusive)character
- Character data to use for the line, including character, colors and modifierspublic DefaultTextGUIGraphics drawImage(TerminalPosition topLeft, TextImage image)
TextGraphics
drawImage(topLeft, image, TerminalPosition.TOP_LEFT_CORNER, image.getSize()
.drawImage
in interface TextGraphics
drawImage
in interface TextGUIGraphics
topLeft
- Position of the top-left corner of the image on the targetimage
- Image to drawpublic DefaultTextGUIGraphics drawImage(TerminalPosition topLeft, TextImage image, TerminalPosition sourceImageTopLeft, TerminalSize sourceImageSize)
TextGraphics
drawImage
in interface TextGraphics
drawImage
in interface TextGUIGraphics
topLeft
- Position of the top-left corner of the image on the targetimage
- Image to drawsourceImageTopLeft
- Position of the top-left corner in the source image to draw at the topLeft position on
the targetsourceImageSize
- How much of the source image to draw on the target, counted from the sourceImageTopLeft
positionpublic DefaultTextGUIGraphics setCharacter(TerminalPosition position, char character)
TextGraphics
setCharacter
in interface TextGraphics
setCharacter
in interface TextGUIGraphics
position
- position of the location to set the charactercharacter
- Character to set at the current positionpublic DefaultTextGUIGraphics setCharacter(TerminalPosition position, TextCharacter character)
TextGraphics
setCharacter
in interface TextGraphics
setCharacter
in interface TextGUIGraphics
position
- position of the location to set the charactercharacter
- Character data to set at the current positionpublic DefaultTextGUIGraphics setCharacter(int column, int row, char character)
TextGraphics
setCharacter
in interface TextGraphics
setCharacter
in interface TextGUIGraphics
column
- column of the location to set the characterrow
- row of the location to set the charactercharacter
- Character to set at the current positionpublic DefaultTextGUIGraphics setCharacter(int column, int row, TextCharacter character)
TextGraphics
setCharacter
in interface TextGraphics
setCharacter
in interface TextGUIGraphics
column
- column of the location to set the characterrow
- row of the location to set the charactercharacter
- Character data to set at the current positionpublic DefaultTextGUIGraphics putString(int column, int row, String string)
TextGraphics
putString
in interface TextGraphics
putString
in interface TextGUIGraphics
column
- What column to put the string atrow
- What row to put the string atstring
- String to put on the screenpublic DefaultTextGUIGraphics putString(TerminalPosition position, String string)
TextGraphics
putString(position.getColumn(), position.getRow(), string);
putString
in interface TextGraphics
putString
in interface TextGUIGraphics
position
- Position to put the string atstring
- String to put on the screenpublic DefaultTextGUIGraphics putString(int column, int row, String string, SGR extraModifier, SGR... optionalExtraModifiers)
TextGraphics
putString
in interface TextGraphics
putString
in interface TextGUIGraphics
column
- What column to put the string atrow
- What row to put the string atstring
- String to put on the screenextraModifier
- Modifier to apply to the stringoptionalExtraModifiers
- Optional extra modifiers to apply to the stringpublic DefaultTextGUIGraphics putString(TerminalPosition position, String string, SGR extraModifier, SGR... optionalExtraModifiers)
TextGraphics
putString(position.getColumn(), position.getRow(), string, modifiers, optionalExtraModifiers);
putString
in interface TextGraphics
putString
in interface TextGUIGraphics
position
- Position to put the string atstring
- String to put on the screenextraModifier
- Modifier to apply to the stringoptionalExtraModifiers
- Optional extra modifiers to apply to the stringpublic DefaultTextGUIGraphics putString(int column, int row, String string, Collection<SGR> extraModifiers)
TextGraphics
putString
in interface TextGraphics
putString
in interface TextGUIGraphics
column
- What column to put the string atrow
- What row to put the string atstring
- String to put on the screenextraModifiers
- Modifier to apply to the stringpublic DefaultTextGUIGraphics putCSIStyledString(int column, int row, String string)
TextGraphics
This method has an additional functionality to the regular TextGraphics.putString(int, int, String)
;
if you embed ANSI CSI-style control sequences (like modifying text color or controlling SGR status), they will be
interpreted as the string is printed and mutates the TextGraphics
object. In this version of Lanterna,
the following sequences are supported:
TextGraphics
object will return to the color/style state it was in at the
start of the call.putCSIStyledString
in interface TextGraphics
putCSIStyledString
in interface TextGUIGraphics
column
- What column to put the string atrow
- What row to put the string atstring
- String to put on the screenpublic DefaultTextGUIGraphics putCSIStyledString(TerminalPosition position, String string)
TextGraphics
This method has an additional functionality to the regular TextGraphics.putString(int, int, String)
;
if you embed ANSI CSI-style control sequences (like modifying text color or controlling SGR status), they will be
interpreted as the string is printed and mutates the TextGraphics
object. In this version of Lanterna,
the following sequences are supported:
TextGraphics
object will return to the color/style state it was in at the
start of the call.putCSIStyledString
in interface TextGraphics
putCSIStyledString
in interface TextGUIGraphics
position
- Position to put the string atstring
- String to put on the screenpublic TextCharacter getCharacter(int column, int row)
TextGraphics
null
if the TextGraphics
implementation doesn't support it or doesn't know what the character is.getCharacter
in interface TextGraphics
column
- Column to return the character forrow
- Row to return the character fornull
if not availablepublic TextCharacter getCharacter(TerminalPosition position)
TextGraphics
null
if the TextGraphics
implementation doesn't support it or doesn't know what the character is.getCharacter
in interface TextGraphics
position
- Position to return the character fornull
if not availablepublic DefaultTextGUIGraphics setStyleFrom(StyleSet<?> source)
StyleSet
setStyleFrom
in interface StyleSet<TextGraphics>
setStyleFrom
in interface TextGUIGraphics
source
- Modifiers to set as activeCopyright © 2020. All rights reserved.