Scrollable
, TextImage
public class ScreenBuffer extends Object implements TextImage
Constructor | Description |
---|---|
ScreenBuffer(TerminalSize size,
TextCharacter filler) |
Creates a new ScreenBuffer with a given size and a TextCharacter to initially fill it with
|
Modifier and Type | Method | Description |
---|---|---|
void |
copyFrom(TextImage source,
int startRowIndex,
int rows,
int startColumnIndex,
int columns,
int destinationRowOffset,
int destinationColumnOffset) |
Copies the content from a TextImage into this buffer.
|
void |
copyTo(TextImage destination) |
Copies this TextImage's content to another TextImage.
|
void |
copyTo(TextImage destination,
int startRowIndex,
int rows,
int startColumnIndex,
int columns,
int destinationRowOffset,
int destinationColumnOffset) |
Copies this TextImage's content to another TextImage.
|
TextCharacter |
getCharacterAt(int column,
int row) |
Returns the character stored at a particular position in this image
|
TextCharacter |
getCharacterAt(TerminalPosition position) |
Returns the character stored at a particular position in this image
|
TerminalSize |
getSize() |
Returns the dimensions of this TextImage, in columns and rows
|
TextGraphics |
newTextGraphics() |
Creates a TextGraphics object that targets this TextImage for all its drawing operations.
|
ScreenBuffer |
resize(TerminalSize newSize,
TextCharacter filler) |
Returns a copy of this image resized to a new size and using a specified filler character if the new size is
larger than the old and we need to fill in empty areas.
|
void |
scrollLines(int firstLine,
int lastLine,
int distance) |
Scroll a range of lines of this TextImage according to given distance.
|
void |
setAll(TextCharacter character) |
Sets the text image content to one specified character (including color and style)
|
void |
setCharacterAt(int column,
int row,
TextCharacter character) |
Sets the character at a specific position in the image to a particular TextCharacter.
|
void |
setCharacterAt(TerminalPosition position,
TextCharacter character) |
Sets the character at a specific position in the image to a particular TextCharacter.
|
String |
toString() |
public ScreenBuffer(TerminalSize size, TextCharacter filler)
size
- Size of the bufferfiller
- What character to set as the initial content of the bufferpublic ScreenBuffer resize(TerminalSize newSize, TextCharacter filler)
TextImage
public TerminalSize getSize()
TextImage
public TextCharacter getCharacterAt(TerminalPosition position)
TextImage
getCharacterAt
in interface TextImage
position
- Coordinates of the characterpublic TextCharacter getCharacterAt(int column, int row)
TextImage
getCharacterAt
in interface TextImage
column
- Column coordinate of the characterrow
- Row coordinate of the characterpublic void setCharacterAt(TerminalPosition position, TextCharacter character)
TextImage
setCharacterAt
in interface TextImage
position
- Coordinates of the charactercharacter
- What TextCharacter to assign at the specified positionpublic void setCharacterAt(int column, int row, TextCharacter character)
TextImage
setCharacterAt
in interface TextImage
column
- Column coordinate of the characterrow
- Row coordinate of the charactercharacter
- What TextCharacter to assign at the specified positionpublic void setAll(TextCharacter character)
TextImage
public TextGraphics newTextGraphics()
TextImage
newTextGraphics
in interface TextImage
public void copyTo(TextImage destination)
TextImage
public void copyTo(TextImage destination, int startRowIndex, int rows, int startColumnIndex, int columns, int destinationRowOffset, int destinationColumnOffset)
TextImage
copyTo
in interface TextImage
destination
- TextImage to copy tostartRowIndex
- Which row in this image to copy fromrows
- How many rows to copystartColumnIndex
- Which column in this image to copy fromcolumns
- How many columns to copydestinationRowOffset
- Offset (in number of rows) in the target image where we want to first copied row to bedestinationColumnOffset
- Offset (in number of columns) in the target image where we want to first copied column to bepublic void copyFrom(TextImage source, int startRowIndex, int rows, int startColumnIndex, int columns, int destinationRowOffset, int destinationColumnOffset)
source
- Source to copy content fromstartRowIndex
- Which row in the source image to start copying fromrows
- How many rows to copystartColumnIndex
- Which column in the source image to start copying fromcolumns
- How many columns to copydestinationRowOffset
- The row offset in this buffer of where to place the copied contentdestinationColumnOffset
- The column offset in this buffer of where to place the copied contentpublic void scrollLines(int firstLine, int lastLine, int distance)
TextImage
scrollLines
in interface Scrollable
scrollLines
in interface TextImage
firstLine
- first line of the range to be scrolled (top line is 0)lastLine
- last (inclusive) line of the range to be scrolleddistance
- if > 0: move lines up, else if < 0: move lines down.Copyright © 2020. All rights reserved.