public abstract class DriverPrimitives extends BasePrimitives
OutputPrimitives.
This class is intended to be a base class for the driver-level primitives implementation. New driver implementation need to implement remaining methods and/or override non-final methods. Remaining code is common for all implementations and there is no need to change it.
The basic idea is to split driver implementation into two parts - completely
implementation dependent part and output primitives implementation. First
part has no common code and should be written from scratch, but has quite
small set of methods (see ScreenDriver for more details on this
part). Second part - output primitives - shares most of the implementation
code and uses minimal set of implementation-specific APIs.
This class (together with its base class) provides almost all necessary shared code, so implementers of the particular driver should implement only small set of implementation-specific methods:
Refer to JavaDoc of each method listed above for more details about requirements to implementation.| Modifier and Type | Field and Description |
|---|---|
private ScreenBitmap |
bitmap
The default clipping bitmap.
|
cursorInvalid, EMPTY_CELL| Constructor and Description |
|---|
DriverPrimitives() |
| Modifier and Type | Method and Description |
|---|---|
void |
append(int chr,
Color color)
Add a character to the virtual terminal at the current cursor
position.
|
Color |
borderColor(Widget widget)
Get color and attribute for border of specified widget.
|
void |
box(int left,
int top,
int right,
int bottom,
Color color)
Draw a box using the specified dimensions and logical color.
|
void |
clearArea(int left,
int top,
int right,
int bottom,
Color color)
Blank out a box using the specified logical color.
|
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.
|
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.
|
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.
|
Color |
widgetColor(Widget widget)
Get color and attribute for the widget area.
|
append, cellAt, cursorAt, cursorStay, getWindowId, getX, getY, hasBoxBorderCorners, isCursorInvalid, setCursorInvalid, updateScreenclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitscreenHeight, screenWidth, syncprivate ScreenBitmap bitmap
public Color borderColor(Widget widget)
Implementation may override this method if it need to change default behavior.
borderColor in class BasePrimitiveswidget - Widget reference.public Color widgetColor(Widget widget)
Implementation may override this method if it need to change default behavior.
widgetColor in class BasePrimitiveswidget - Widget reference.public final void append(int chr,
Color color)
append in class BasePrimitiveschr - The character to output.color - The number of the color-pair (foreground + background) to
use for blanking the rectangle.public final void box(int left,
int top,
int right,
int bottom,
Color color)
The driver-level implementation does not need to override this method.
box in class BasePrimitivesleft - 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 final void clearArea(int left,
int top,
int right,
int bottom,
Color color)
The driver-level implementation does not need to override this method.
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 final void drawHBorder(int col,
int row,
int width,
Color color)
The driver-level implementation does not need to override this method.
drawHBorder in class BasePrimitivescol - 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 final void drawLLCorner(int col,
int row,
Color color)
The driver-level implementation does not need to override this method.
drawLLCorner in class BasePrimitivescol - 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 final void drawLRCorner(int col,
int row,
Color color)
The driver-level implementation does not need to override this method.
drawLRCorner in class BasePrimitivescol - 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 final void drawULCorner(int col,
int row,
Color color)
The driver-level implementation does not need to override this method.
drawULCorner in class BasePrimitivescol - 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 final void drawURCorner(int col,
int row,
Color color)
The driver-level implementation does not need to override this method.
drawURCorner in class BasePrimitivescol - 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 final void drawVBorder(int col,
int row,
int height,
Color color)
The driver-level implementation does not need to override this method.
drawVBorder in class BasePrimitivescol - 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)public final ScreenBitmap getScreenBitmap()
The driver-level implementation does not need to override this method.
public final void hLine(int length,
Color color)
The driver-level implementation does not need to override this method.
hLine in class BasePrimitiveslength - The length of the line to draw in columns.color - The number of the color-pair (foreground + background).public final void refresh(NativeRectangle rect)
The driver-level implementation does not need to override or implement this method.
rect - rectangle to mark for repaintingpublic final void setScreenBitmap(ScreenBitmap bitmap)
The driver-level implementation does not need to override this method.
bitmap - The new bitmap instance.public final void vLine(int length,
Color color)
The driver-level implementation does not need to override this method.
vLine in class BasePrimitiveslength - The length of the line to draw in rows.color - The number of the color-pair (foreground + background).