public class DirectPrimitives extends BasePrimitives
Modifier and Type | Field and Description |
---|---|
private BasePrimitives |
buffer
Shadow buffer.
|
private BasePrimitives |
direct
Original direct output primitives.
|
cursorInvalid, EMPTY_CELL
Constructor and Description |
---|
DirectPrimitives(BasePrimitives direct)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
append(int chr,
Color color)
Add a character to the virtual terminal at the current cursor
position.
|
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.
|
Cell |
cellAt(int row,
int col)
Get character at specified position.
|
void |
clear()
Clear the buffer bitmaps.
|
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.
|
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.
|
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.
|
boolean |
hasBoxBorderCorners()
Check if this output primitives implementation requires border corners
when drawing a box.
|
void |
hLine(int length,
Color color)
Draw a horizontal line of the specified length starting at the
current cursor position.
|
void |
refresh(NativeRectangle rect)
Mark a rectangle as needing repainting.
|
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 |
sync()
Synchronize the state of the physical terminal with the state of
the virtual terminal.
|
void |
updateScreen(ScreenData screen)
Perform a bulk output operation for the whole screen at once with
output masking when desired.
|
void |
vLine(int length,
Color color)
Draw a vertical line of the specified length starting at the current
cursor position.
|
borderColor, getWindowId, isCursorInvalid, setCursorInvalid, widgetColor
private final BasePrimitives direct
private final BasePrimitives buffer
public DirectPrimitives(BasePrimitives direct)
direct
- Toolkit instance used for direct drawing.public void updateScreen(ScreenData screen)
updateScreen
in class BasePrimitives
screen
- Container for whole screen content and cursor position.public ScreenBitmap getScreenBitmap()
public void setScreenBitmap(ScreenBitmap bitmap)
bitmap
- The new bitmap instance.public void append(int chr, Color color)
append
in class BasePrimitives
chr
- The character to output.color
- The number of the color-pair (foreground + background) to
use for blanking the rectangle.public void append(java.lang.String str, Color color)
append
in class BasePrimitives
str
- The text to output.color
- The number of the color-pair (foreground + background) to
use for blanking the rectangle.public void hLine(int length, Color color)
hLine
in class BasePrimitives
length
- The length of the line to draw in columns.color
- The number of the color-pair (foreground + background).public void vLine(int length, Color color)
vLine
in class BasePrimitives
length
- The length of the line to draw in rows.color
- The number of the color-pair (foreground + background).public 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 number of the color-pair (foreground + background).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 number of the color-pair (foreground + background).public int getX()
getX
in class BasePrimitives
public int getY()
getY
in class BasePrimitives
public void refresh(NativeRectangle rect)
rect
- rectangle to mark for repaintingpublic boolean cursorAt(int x, int y)
cursorAt
in class BasePrimitives
x
- y
- true
if cursor positioning succeeded.public boolean cursorStay(int x, int y)
cursorStay
in class BasePrimitives
x
- y
- true
if cursor positioning succeeded.public int screenWidth()
public int screenHeight()
public void sync()
public void clear()
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
- Color.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
- Color.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
- Color.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
- Color.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
- Color.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
- Color.public boolean hasBoxBorderCorners()
true
.hasBoxBorderCorners
in class BasePrimitives
true
, as the box will be drawn with border
corners.public Cell cellAt(int row, int col)
cellAt
in class BasePrimitives
row
- Character row.col
- Character column.