public class LogicalScreen extends java.lang.Object implements Screen
Modifier and Type | Field and Description |
---|---|
protected boolean |
cursorVisible
If true, the cursor is visible and should be placed onscreen at
(cursorX, cursorY) during a call to flushPhysical().
|
protected int |
cursorX
Cursor X position if visible.
|
protected int |
cursorY
Cursor Y position if visible.
|
protected int |
height
Height of the visible window.
|
protected Cell[][] |
logical
The logical screen being rendered to.
|
protected Cell[][] |
physical
The physical screen last sent out on flush().
|
protected boolean |
reallyCleared
Set if the user explicitly wants to redraw everything starting with a
ECMATerminal.clearAll().
|
protected int |
width
Width of the visible window.
|
Modifier | Constructor and Description |
---|---|
protected |
LogicalScreen()
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the logical screen.
|
void |
clearPhysical()
Clear the physical screen.
|
void |
drawBox(int left,
int top,
int right,
int bottom,
CellAttributes border,
CellAttributes background)
Draw a box with a border and empty background.
|
void |
drawBox(int left,
int top,
int right,
int bottom,
CellAttributes border,
CellAttributes background,
int borderType,
boolean shadow)
Draw a box with a border and empty background.
|
void |
drawBoxShadow(int left,
int top,
int right,
int bottom)
Draw a box shadow.
|
void |
flushPhysical()
Default implementation does nothing.
|
CellAttributes |
getAttrXY(int x,
int y)
Get the attributes at one location.
|
Cell |
getCharXY(int x,
int y)
Get the cell at one location.
|
int |
getClipBottom()
Get bottom drawing clipping boundary.
|
int |
getClipLeft()
Get left drawing clipping boundary.
|
int |
getClipRight()
Get right drawing clipping boundary.
|
int |
getClipTop()
Get top drawing clipping boundary.
|
int |
getCursorX()
Get the cursor X position.
|
int |
getCursorY()
Get the cursor Y position.
|
int |
getHeight()
Get the height.
|
int |
getTextHeight()
Get the height of a character cell in pixels.
|
int |
getTextWidth()
Get the width of a character cell in pixels.
|
int |
getWidth()
Get the width.
|
void |
hideCursor()
Hide the cursor.
|
void |
hLineXY(int x,
int y,
int n,
int ch,
CellAttributes attr)
Draw a horizontal line from (x, y) to (x + n, y).
|
boolean |
isCursorVisible()
Get the cursor visibility.
|
boolean |
isDirty()
Get dirty flag.
|
void |
putAll(int ch,
CellAttributes attr)
Fill the entire screen with one character with attributes.
|
void |
putAttrXY(int x,
int y,
CellAttributes attr)
Set the attributes at one location.
|
void |
putAttrXY(int x,
int y,
CellAttributes attr,
boolean clip)
Set the attributes at one location.
|
void |
putCharXY(int x,
int y,
Cell ch)
Render one character with attributes.
|
void |
putCharXY(int x,
int y,
int ch)
Render one character without changing the underlying attributes.
|
void |
putCharXY(int x,
int y,
int ch,
CellAttributes attr)
Render one character with attributes.
|
void |
putCursor(boolean visible,
int x,
int y)
Put the cursor at (x,y).
|
void |
putFullwidthCharXY(int x,
int y,
Cell cell)
Render one fullwidth cell.
|
void |
putFullwidthCharXY(int x,
int y,
int ch)
Render one fullwidth character with attributes.
|
void |
putFullwidthCharXY(int x,
int y,
int ch,
CellAttributes attr)
Render one fullwidth character with attributes.
|
void |
putStringXY(int x,
int y,
java.lang.String str)
Render a string without changing the underlying attribute.
|
void |
putStringXY(int x,
int y,
java.lang.String str,
CellAttributes attr)
Render a string.
|
void |
reset()
Reset screen to not-bold, white-on-black.
|
void |
resetClipping()
Flush the offset and clip variables.
|
void |
resizeToScreen()
Resize the physical screen to match the logical screen dimensions.
|
void |
setClipBottom(int clipBottom)
Set bottom drawing clipping boundary.
|
void |
setClipLeft(int clipLeft)
Set left drawing clipping boundary.
|
void |
setClipRight(int clipRight)
Set right drawing clipping boundary.
|
void |
setClipTop(int clipTop)
Set top drawing clipping boundary.
|
void |
setDimensions(int width,
int height)
Change the width and height.
|
void |
setHeight(int height)
Change the height.
|
void |
setOffsetX(int offsetX)
Set drawing offset for x.
|
void |
setOffsetY(int offsetY)
Set drawing offset for y.
|
void |
setTitle(java.lang.String title)
Set the window title.
|
void |
setWidth(int width)
Change the width.
|
void |
unsetImageRow(int y)
Unset every image cell on one row of the physical screen, forcing
images on that row to be redrawn.
|
void |
vLineXY(int x,
int y,
int n,
int ch,
CellAttributes attr)
Draw a vertical line from (x, y) to (x, y + n).
|
protected int width
protected int height
protected Cell[][] physical
protected Cell[][] logical
protected boolean reallyCleared
protected boolean cursorVisible
protected int cursorX
protected int cursorY
protected LogicalScreen()
public int getTextWidth()
getTextWidth
in interface Screen
public int getTextHeight()
getTextHeight
in interface Screen
public final void setOffsetX(int offsetX)
setOffsetX
in interface Screen
offsetX
- new drawing offsetpublic final void setOffsetY(int offsetY)
setOffsetY
in interface Screen
offsetY
- new drawing offsetpublic final int getClipRight()
getClipRight
in interface Screen
public final void setClipRight(int clipRight)
setClipRight
in interface Screen
clipRight
- new boundarypublic final int getClipBottom()
getClipBottom
in interface Screen
public final void setClipBottom(int clipBottom)
setClipBottom
in interface Screen
clipBottom
- new boundarypublic final int getClipLeft()
getClipLeft
in interface Screen
public final void setClipLeft(int clipLeft)
setClipLeft
in interface Screen
clipLeft
- new boundarypublic final int getClipTop()
getClipTop
in interface Screen
public final void setClipTop(int clipTop)
setClipTop
in interface Screen
clipTop
- new boundarypublic final boolean isDirty()
public final CellAttributes getAttrXY(int x, int y)
public Cell getCharXY(int x, int y)
public final void putAttrXY(int x, int y, CellAttributes attr)
public final void putAttrXY(int x, int y, CellAttributes attr, boolean clip)
public final void putAll(int ch, CellAttributes attr)
public final void putCharXY(int x, int y, Cell ch)
public final void putCharXY(int x, int y, int ch, CellAttributes attr)
public final void putCharXY(int x, int y, int ch)
public final void putStringXY(int x, int y, java.lang.String str, CellAttributes attr)
putStringXY
in interface Screen
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.str
- string to drawattr
- attributes to use (bold, foreColor, backColor)public final void putStringXY(int x, int y, java.lang.String str)
putStringXY
in interface Screen
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.str
- string to drawpublic final void vLineXY(int x, int y, int n, int ch, CellAttributes attr)
public final void hLineXY(int x, int y, int n, int ch, CellAttributes attr)
public final void setWidth(int width)
public final void setHeight(int height)
public final void setDimensions(int width, int height)
setDimensions
in interface Screen
width
- new screen widthheight
- new screen heightpublic void resizeToScreen()
public final int getHeight()
public final int getWidth()
public final void reset()
public final void resetClipping()
resetClipping
in interface Screen
public final void drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background)
drawBox
in interface Screen
left
- left column of box. 0 is the left-most column.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the boxborder
- attributes to use for the borderbackground
- attributes to use for the backgroundpublic final void drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background, int borderType, boolean shadow)
drawBox
in interface Screen
left
- left column of box. 0 is the left-most column.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the boxborder
- attributes to use for the borderbackground
- attributes to use for the backgroundborderType
- if 1, draw a single-line border; if 2, draw a
double-line border; if 3, draw double-line top/bottom edges and
single-line left/right edges (like Qmodem)shadow
- if true, draw a "shadow" on the boxpublic final void drawBoxShadow(int left, int top, int right, int bottom)
drawBoxShadow
in interface Screen
left
- left column of box. 0 is the left-most column.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the boxpublic void flushPhysical()
flushPhysical
in interface Screen
public void putCursor(boolean visible, int x, int y)
public final void hideCursor()
hideCursor
in interface Screen
public boolean isCursorVisible()
isCursorVisible
in interface Screen
public int getCursorX()
getCursorX
in interface Screen
public int getCursorY()
getCursorY
in interface Screen
public void setTitle(java.lang.String title)
public final void clearPhysical()
clearPhysical
in interface Screen
public final void unsetImageRow(int y)
unsetImageRow
in interface Screen
y
- row coordinate. 0 is the top-most row.public final void putFullwidthCharXY(int x, int y, Cell cell)
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.cell
- the cell to drawpublic final void putFullwidthCharXY(int x, int y, int ch, CellAttributes attr)
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.ch
- character to drawattr
- attributes to use (bold, foreColor, backColor)public final void putFullwidthCharXY(int x, int y, int ch)
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.ch
- character to drawCopyright © 2019 Kevin Lamonte. Licensed MIT.