public abstract class AbstractTerminalBuffer extends BasePrimitives
Modifier and Type | Field and Description |
---|---|
private ScreenBitmap |
bitmap
The default clipping bitmap.
|
protected int |
cols
Number of columns on the screen.
|
protected int |
csx
The current stay X coordinate of the cursor.
|
protected int |
csy
The current stay Y coordinate of the cursor.
|
protected int |
cx
The current drawing X coordinate of the cursor.
|
protected int |
cy
The current drawing Y coordinate of the cursor.
|
private Cell[][] |
render
Current rendering buffer.
|
protected int |
rows
Number of lines on the screen.
|
cursorInvalid, EMPTY_CELL
Constructor and Description |
---|
AbstractTerminalBuffer(int rows,
int cols)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
advanceCursor()
Advance the cursor to the next screen position with wrapping around
the line and and the screen end.
|
void |
append(java.lang.String str,
Color color)
Add a string to the virtual terminal at the current cursor position.
|
void |
box(int left,
int top,
int right,
int bottom,
Color color)
Draw a box using the specified dimensions and color pair.
|
void |
clearArea(int left,
int top,
int right,
int bottom,
Color color)
Blank out a box using the specified attributes and color pair.
|
boolean |
cursorAt(int x,
int y)
Position the virtual cursor during the drawing.
|
protected void |
cursorRelocated(int csx,
int csy)
Callback method when cursor is actually relocated at given position.
|
boolean |
cursorStay(int x,
int y)
Position the real cursor.
|
void |
drawHBorder(int col,
int row,
int width,
Color color)
Draw the upper or lower border.
|
void |
drawLLCorner(int col,
int row,
Color color)
Draw the lower-left border corner.
|
void |
drawLRCorner(int col,
int row,
Color color)
Draw the lower-right border corner.
|
void |
drawULCorner(int col,
int row,
Color color)
Draw the upper-left border corner.
|
void |
drawURCorner(int col,
int row,
Color color)
Draw the upper-right border corner.
|
void |
drawVBorder(int col,
int row,
int height,
Color color)
Draw the left or right border.
|
private void |
fillScreen(Cell cell)
Fill entire terminal screen with specified cell.
|
ScreenBitmap |
getScreenBitmap()
Get the screen bitmap for this output primitives implementation.
|
int |
getX()
Get absolute X position of the cursor.
|
int |
getY()
Get absolute Y position of the cursor.
|
void |
hLine(int length,
Color color)
Draw a horizontal line of the specified length starting at the
current cursor position.
|
protected Cell[][] |
render()
Get access to rendering buffer.
|
int |
screenHeight()
Gets the number of rows on the screen.
|
int |
screenWidth()
Gets the number of columns on the screen.
|
void |
setScreenBitmap(ScreenBitmap bitmap)
Replace the current bitmap instance with this one.
|
void |
vLine(int length,
Color color)
Draw a vertical line of the specified length starting at the current
cursor position.
|
append, borderColor, cellAt, getWindowId, hasBoxBorderCorners, isCursorInvalid, setCursorInvalid, updateScreen, widgetColor
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
refresh, sync
protected final int cols
protected final int rows
private final Cell[][] render
protected int cx
protected int cy
protected int csx
protected int csy
private ScreenBitmap bitmap
public AbstractTerminalBuffer(int rows, int cols)
rows
- Number of rows in buffer.cols
- Number of columns in buffer.public void append(java.lang.String str, Color color)
append
in class BasePrimitives
str
- The text to output.color
- The color to usepublic void hLine(int length, Color color)
hLine
in class BasePrimitives
length
- The length of the line to draw in columns.color
- The color to usepublic void vLine(int length, Color color)
vLine
in class BasePrimitives
length
- The length of the line to draw in rows.color
- The color to usepublic void clearArea(int left, int top, int right, int bottom, Color color)
left
- The left column of the rectangle.top
- The top row of the rectangle.right
- The right column of the rectangle.bottom
- The bottom row of the rectangle.color
- The color to use.public void box(int left, int top, int right, int bottom, Color color)
box
in class BasePrimitives
left
- The left column of the rectangle.top
- The top row of the rectangle.right
- The right column of the rectangle.bottom
- The bottom row of the rectangle.color
- The color to usepublic int getX()
getX
in class BasePrimitives
public int getY()
getY
in class BasePrimitives
public boolean cursorAt(int x, int y)
cursorAt
in class BasePrimitives
x
- columny
- rowtrue
if cursor positioning succeeded.public ScreenBitmap getScreenBitmap()
public void setScreenBitmap(ScreenBitmap bitmap)
bitmap
- The new bitmap instance.public void drawULCorner(int col, int row, Color color)
drawULCorner
in class BasePrimitives
col
- The column number where to draw.row
- The row number where to draw.color
- The number of the color-pair (foreground+background) to use
for blanking the rectangle.public void drawURCorner(int col, int row, Color color)
drawURCorner
in class BasePrimitives
col
- The column number where to draw.row
- The row number where to draw.color
- The number of the color-pair (foreground+background) to use
for blanking the rectangle.public void drawLLCorner(int col, int row, Color color)
drawLLCorner
in class BasePrimitives
col
- The column number where to draw.row
- The row number where to draw.color
- The number of the color-pair (foreground+background) to use
for blanking the rectangle.public void drawLRCorner(int col, int row, Color color)
drawLRCorner
in class BasePrimitives
col
- The column number where to draw.row
- The row number where to draw.color
- The number of the color-pair (foreground+background) to use
for blanking the rectangle.public void drawHBorder(int col, int row, int width, Color color)
drawHBorder
in class BasePrimitives
col
- The column number where to draw.row
- The row number where to draw.width
- The border width.color
- The number of the color-pair (foreground+background)public void drawVBorder(int col, int row, int height, Color color)
drawVBorder
in class BasePrimitives
col
- The column number where to draw.row
- The row number where to draw.height
- The border height.color
- The number of the color-pair (foreground+background)private void fillScreen(Cell cell)
cell
- Source cell.protected Cell[][] render()
protected void advanceCursor()
public boolean cursorStay(int x, int y)
cursorStay
in class BasePrimitives
x
- Cursor X.y
- Cursor Y.true
if cursor positioning succeeded.protected void cursorRelocated(int csx, int csy)
csx
- Cursor X.csy
- Cursor Y.public int screenWidth()
public int screenHeight()