Package jexer.backend
Interface Screen
-
- All Known Implementing Classes:
ECMA48Terminal,HeadlessBackend,LogicalScreen,MultiScreen,SwingTerminal
public interface ScreenDrawing operations API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidblendRectangle(int x, int y, int width, int height, int color, int alpha)Alpha-blend a rectangle with a specified color and alpha onto this screen.voidblendScreen(Screen otherScreen, int x, int y, int width, int height, int alpha, boolean filterHatch)Alpha-blend a rectangular portion of another screen onto this one.voidclear()Clear the logical screen.voidclearPhysical()Clear the physical screen.voidcopyScreen(Screen other)Copy all of screen's data to this screen.voidcopyScreen(Screen other, int x, int y, int width, int height)Copy a rectangular portion of another screen to this one.voidcopySelection(Clipboard clipboard, int x0, int y0, int x1, int y1, boolean rectangle)Copy the screen selection area to the clipboard.voiddrawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background)Draw a box with a border and empty background.voiddrawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background, BorderStyle borderStyle, boolean shadow)Draw a box with a border and empty background.voiddrawBoxShadow(int left, int top, int right, int bottom)Draw a box shadow.voidflushPhysical()Classes must provide an implementation to push the logical screen to the physical device.CellAttributesgetAttrXY(int x, int y)Get the attributes at one location.BackendgetBackend()Get the backend that instantiated this screen.CellgetCharXY(int x, int y)Get the cell at one location in absolute coordinates.CellgetCharXY(int x, int y, boolean clip)Get the cell at one location, in either absolute or clipped coordinates.intgetClipBottom()Get bottom drawing clipping boundary.intgetClipLeft()Get left drawing clipping boundary.intgetClipRight()Get right drawing clipping boundary.intgetClipTop()Get top drawing clipping boundary.intgetCursorX()Get the cursor X position.intgetCursorY()Get the cursor Y position.intgetHeight()Get the height.intgetOffsetX()Get drawing offset for x.intgetOffsetY()Get drawing offset for y.intgetTextHeight()Get the height of a character cell in pixels.intgetTextWidth()Get the width of a character cell in pixels.intgetWidth()Get the width.voidhideCursor()Hide the cursor.voidhLineXY(int x, int y, int n, int ch, CellAttributes attr)Draw a horizontal line from (x, y) to (x + n, y).voidhLineXY(int x, int y, int n, Cell ch)Draw a horizontal line from (x, y) to (x + n, y).voidinvertCell(int x, int y)Invert the cell color at a position, including both halves of a double-width cell.voidinvertCell(int x, int y, boolean onlyThisCell)Invert the cell color at a position.booleanisCursorVisible()Get the cursor visibility.booleanisDirty()Get dirty flag.voidputAll(int ch, CellAttributes attr)Fill the entire screen with one character with attributes.voidputAttrXY(int x, int y, CellAttributes attr)Set the attributes at one location.voidputAttrXY(int x, int y, CellAttributes attr, boolean clip)Set the attributes at one location.voidputCharXY(int x, int y, int ch)Render one character without changing the underlying attributes.voidputCharXY(int x, int y, int ch, CellAttributes attr)Render one character with attributes.voidputCharXY(int x, int y, Cell ch)Render one character with attributes.voidputCursor(boolean visible, int x, int y)Put the cursor at (x,y).voidputStringXY(int x, int y, java.lang.String str)Render a string without changing the underlying attribute.voidputStringXY(int x, int y, java.lang.String str, CellAttributes attr)Render a string.voidreset()Reset screen to not-bold, white-on-black.voidresetClipping()Flush the offset and clip variables.voidsetClipBottom(int clipBottom)Set bottom drawing clipping boundary.voidsetClipLeft(int clipLeft)Set left drawing clipping boundary.voidsetClipRight(int clipRight)Set right drawing clipping boundary.voidsetClipTop(int clipTop)Set top drawing clipping boundary.voidsetDimensions(int width, int height)Change the width and height.voidsetHeight(int height)Change the height.voidsetOffsetX(int offsetX)Set drawing offset for x.voidsetOffsetY(int offsetY)Set drawing offset for y.voidsetSelection(int x0, int y0, int x1, int y1, boolean rectangle)Set a selection area on the screen.voidsetTitle(java.lang.String title)Set the window title.voidsetWidth(int width)Change the width.Screensnapshot()Obtain a snapshot copy of the screen.Screensnapshot(int x, int y, int width, int height)Obtain a snapshot copy of a rectangular portion of the screen.ScreensnapshotPhysical(int x, int y, int width, int height)Obtain a snapshot copy of a rectangular portion of the screen of the PHYSICAL screen - what was LAST emitted.voidunsetImageRow(int y)Unset every image cell on one row of the physical screen, forcing images on that row to be redrawn.voidvLineXY(int x, int y, int n, int ch, CellAttributes attr)Draw a vertical line from (x, y) to (x, y + n).voidvLineXY(int x, int y, int n, Cell ch)Draw a vertical line from (x, y) to (x, y + n).
-
-
-
Method Detail
-
setOffsetX
void setOffsetX(int offsetX)
Set drawing offset for x.- Parameters:
offsetX- new drawing offset
-
getOffsetX
int getOffsetX()
Get drawing offset for x.- Returns:
- the drawing offset
-
setOffsetY
void setOffsetY(int offsetY)
Set drawing offset for y.- Parameters:
offsetY- new drawing offset
-
getOffsetY
int getOffsetY()
Get drawing offset for y.- Returns:
- the drawing offset
-
getClipRight
int getClipRight()
Get right drawing clipping boundary.- Returns:
- drawing boundary
-
setClipRight
void setClipRight(int clipRight)
Set right drawing clipping boundary.- Parameters:
clipRight- new boundary
-
getClipBottom
int getClipBottom()
Get bottom drawing clipping boundary.- Returns:
- drawing boundary
-
setClipBottom
void setClipBottom(int clipBottom)
Set bottom drawing clipping boundary.- Parameters:
clipBottom- new boundary
-
getClipLeft
int getClipLeft()
Get left drawing clipping boundary.- Returns:
- drawing boundary
-
setClipLeft
void setClipLeft(int clipLeft)
Set left drawing clipping boundary.- Parameters:
clipLeft- new boundary
-
getClipTop
int getClipTop()
Get top drawing clipping boundary.- Returns:
- drawing boundary
-
setClipTop
void setClipTop(int clipTop)
Set top drawing clipping boundary.- Parameters:
clipTop- new boundary
-
isDirty
boolean isDirty()
Get dirty flag.- Returns:
- if true, the logical screen is not in sync with the physical screen
-
getAttrXY
CellAttributes getAttrXY(int x, int y)
Get the attributes at one location.- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.- Returns:
- attributes at (x, y)
-
getCharXY
Cell getCharXY(int x, int y)
Get the cell at one location in absolute coordinates.- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.- Returns:
- the character + attributes
-
getCharXY
Cell getCharXY(int x, int y, boolean clip)
Get the cell at one location, in either absolute or clipped coordinates.- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.clip- if true, honor clipping/offset- Returns:
- the character + attributes, or null if this position is outside the clipping/offset region
-
putAttrXY
void putAttrXY(int x, int y, CellAttributes attr)Set the attributes at one location.- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.attr- attributes to use (bold, foreColor, backColor)
-
putAttrXY
void putAttrXY(int x, int y, CellAttributes attr, boolean clip)Set the attributes at one location.- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.attr- attributes to use (bold, foreColor, backColor)clip- if true, honor clipping/offset
-
putAll
void putAll(int ch, CellAttributes attr)Fill the entire screen with one character with attributes.- Parameters:
ch- character to drawattr- attributes to use (bold, foreColor, backColor)
-
putCharXY
void putCharXY(int x, int y, Cell ch)Render one character with attributes.- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.ch- character + attributes to draw
-
putCharXY
void putCharXY(int x, int y, int ch, CellAttributes attr)Render one character with attributes.- Parameters:
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)
-
putCharXY
void putCharXY(int x, int y, int ch)Render one character without changing the underlying attributes.- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.ch- character to draw
-
putStringXY
void putStringXY(int x, int y, java.lang.String str, CellAttributes attr)Render a string. Does not wrap if the string exceeds the line.- Parameters:
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)
-
putStringXY
void putStringXY(int x, int y, java.lang.String str)Render a string without changing the underlying attribute. Does not wrap if the string exceeds the line.- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.str- string to draw
-
vLineXY
void vLineXY(int x, int y, int n, int ch, CellAttributes attr)Draw a vertical line from (x, y) to (x, y + n).- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.n- number of characters to drawch- character to drawattr- attributes to use (bold, foreColor, backColor)
-
vLineXY
void vLineXY(int x, int y, int n, Cell ch)Draw a vertical line from (x, y) to (x, y + n).- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.n- number of characters to drawch- character to draw
-
hLineXY
void hLineXY(int x, int y, int n, int ch, CellAttributes attr)Draw a horizontal line from (x, y) to (x + n, y).- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.n- number of characters to drawch- character to drawattr- attributes to use (bold, foreColor, backColor)
-
hLineXY
void hLineXY(int x, int y, int n, Cell ch)Draw a horizontal line from (x, y) to (x + n, y).- Parameters:
x- column coordinate. 0 is the left-most column.y- row coordinate. 0 is the top-most row.n- number of characters to drawch- character to draw
-
setWidth
void setWidth(int width)
Change the width. Everything on-screen will be destroyed and must be redrawn.- Parameters:
width- new screen width
-
setHeight
void setHeight(int height)
Change the height. Everything on-screen will be destroyed and must be redrawn.- Parameters:
height- new screen height
-
setDimensions
void setDimensions(int width, int height)Change the width and height. Everything on-screen will be destroyed and must be redrawn.- Parameters:
width- new screen widthheight- new screen height
-
getHeight
int getHeight()
Get the height.- Returns:
- current screen height
-
getWidth
int getWidth()
Get the width.- Returns:
- current screen width
-
reset
void reset()
Reset screen to not-bold, white-on-black. Also flushes the offset and clip variables.
-
resetClipping
void resetClipping()
Flush the offset and clip variables.
-
clear
void clear()
Clear the logical screen.
-
drawBox
void drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background)Draw a box with a border and empty background.- Parameters:
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 background
-
drawBox
void drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background, BorderStyle borderStyle, boolean shadow)Draw a box with a border and empty background.- Parameters:
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 backgroundborderStyle- style of bordershadow- if true, draw a "shadow" on the box
-
drawBoxShadow
void drawBoxShadow(int left, int top, int right, int bottom)Draw a box shadow.- Parameters:
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 box
-
clearPhysical
void clearPhysical()
Clear the physical screen.
-
unsetImageRow
void unsetImageRow(int y)
Unset every image cell on one row of the physical screen, forcing images on that row to be redrawn.- Parameters:
y- row coordinate. 0 is the top-most row.
-
flushPhysical
void flushPhysical()
Classes must provide an implementation to push the logical screen to the physical device.
-
putCursor
void putCursor(boolean visible, int x, int y)Put the cursor at (x,y).- Parameters:
visible- if true, the cursor should be visiblex- column coordinate to put the cursor ony- row coordinate to put the cursor on
-
hideCursor
void hideCursor()
Hide the cursor.
-
isCursorVisible
boolean isCursorVisible()
Get the cursor visibility.- Returns:
- true if the cursor is visible
-
getCursorX
int getCursorX()
Get the cursor X position.- Returns:
- the cursor x column position
-
getCursorY
int getCursorY()
Get the cursor Y position.- Returns:
- the cursor y row position
-
setTitle
void setTitle(java.lang.String title)
Set the window title.- Parameters:
title- the new title
-
getTextWidth
int getTextWidth()
Get the width of a character cell in pixels.- Returns:
- the width in pixels of a character cell
-
getTextHeight
int getTextHeight()
Get the height of a character cell in pixels.- Returns:
- the height in pixels of a character cell
-
invertCell
void invertCell(int x, int y)Invert the cell color at a position, including both halves of a double-width cell.- Parameters:
x- column positiony- row position
-
invertCell
void invertCell(int x, int y, boolean onlyThisCell)Invert the cell color at a position.- Parameters:
x- column positiony- row positiononlyThisCell- if true, only invert this cell, otherwise invert both halves of a double-width cell if necessary
-
setSelection
void setSelection(int x0, int y0, int x1, int y1, boolean rectangle)Set a selection area on the screen.- Parameters:
x0- the starting X position of the selectiony0- the starting Y position of the selectionx1- the ending X position of the selectiony1- the ending Y position of the selectionrectangle- if true, this is a rectangle select
-
copySelection
void copySelection(Clipboard clipboard, int x0, int y0, int x1, int y1, boolean rectangle)
Copy the screen selection area to the clipboard.- Parameters:
clipboard- the clipboard to usex0- the starting X position of the selectiony0- the starting Y position of the selectionx1- the ending X position of the selectiony1- the ending Y position of the selectionrectangle- if true, this is a rectangle select
-
snapshot
Screen snapshot()
Obtain a snapshot copy of the screen.- Returns:
- a copy of the screen's data
-
snapshotPhysical
Screen snapshotPhysical(int x, int y, int width, int height)
Obtain a snapshot copy of a rectangular portion of the screen of the PHYSICAL screen - what was LAST emitted.- Parameters:
x- left column of rectangle. 0 is the left-most column.y- top row of the rectangle. 0 is the top-most row.width- number of columns to copyheight- number of rows to copy- Returns:
- a copy of the screen's data from this rectangle. Any cells outside the actual screen dimensions will be blank.
-
snapshot
Screen snapshot(int x, int y, int width, int height)
Obtain a snapshot copy of a rectangular portion of the screen.- Parameters:
x- left column of rectangle. 0 is the left-most column.y- top row of the rectangle. 0 is the top-most row.width- number of columns to copyheight- number of rows to copy- Returns:
- a copy of the screen's data from this rectangle. Any cells outside the actual screen dimensions will be blank.
-
copyScreen
void copyScreen(Screen other)
Copy all of screen's data to this screen.- Parameters:
other- the other screen
-
copyScreen
void copyScreen(Screen other, int x, int y, int width, int height)
Copy a rectangular portion of another screen to this one. Any cells outside this screen's dimensions will be ignored.- Parameters:
other- the other screenx- left column of rectangle. 0 is the left-most column.y- top row of the rectangle. 0 is the top-most row.width- number of columns to copyheight- number of rows to copy
-
blendScreen
void blendScreen(Screen otherScreen, int x, int y, int width, int height, int alpha, boolean filterHatch)
Alpha-blend a rectangular portion of another screen onto this one. Any cells outside this screen's dimensions will be ignored.- Parameters:
otherScreen- the other screenx- left column of rectangle. 0 is the left-most column.y- top row of the rectangle. 0 is the top-most row.width- number of columns to copyheight- number of rows to copyalpha- the alpha transparency level (0 - 255) to use for cells from the other screenfilterHatch- if true, prevent hatch-like characters from showing through
-
blendRectangle
void blendRectangle(int x, int y, int width, int height, int color, int alpha)Alpha-blend a rectangle with a specified color and alpha onto this screen. Any cells outside this screen's dimensions will be ignored.- Parameters:
x- left column of rectangle. 0 is the left-most column.y- top row of the rectangle. 0 is the top-most row.width- number of columns to copyheight- number of rows to copycolor- the RGB color to blendalpha- the alpha transparency level (0 - 255) to use for cells from the other screen
-
getBackend
Backend getBackend()
Get the backend that instantiated this screen.- Returns:
- the backend
-
-