From 72088134c36dfef68bc6e0da236fec0710962000 Mon Sep 17 00:00:00 2001 From: Autumn Lamonte Date: Sat, 29 Jan 2022 21:22:59 -0600 Subject: [PATCH] #97 simplify MultiScreen --- src/jexer/backend/LogicalScreen.java | 8 +- src/jexer/backend/MultiBackend.java | 5 +- src/jexer/backend/MultiScreen.java | 979 ++------------------------- 3 files changed, 64 insertions(+), 928 deletions(-) diff --git a/src/jexer/backend/LogicalScreen.java b/src/jexer/backend/LogicalScreen.java index b5b9801..94f5a5b 100644 --- a/src/jexer/backend/LogicalScreen.java +++ b/src/jexer/backend/LogicalScreen.java @@ -706,7 +706,7 @@ public class LogicalScreen implements Screen { * * @param width new screen width */ - public final synchronized void setWidth(final int width) { + public synchronized void setWidth(final int width) { reallocate(width, this.height); } @@ -716,7 +716,7 @@ public class LogicalScreen implements Screen { * * @param height new screen height */ - public final synchronized void setHeight(final int height) { + public synchronized void setHeight(final int height) { reallocate(this.width, height); } @@ -727,7 +727,7 @@ public class LogicalScreen implements Screen { * @param width new screen width * @param height new screen height */ - public final void setDimensions(final int width, final int height) { + public void setDimensions(final int width, final int height) { reallocate(width, height); resizeToScreen(); } @@ -1035,7 +1035,7 @@ public class LogicalScreen implements Screen { /** * Clear the physical screen. */ - public synchronized final void clearPhysical() { + public synchronized void clearPhysical() { for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { physical[col][row].unset(); diff --git a/src/jexer/backend/MultiBackend.java b/src/jexer/backend/MultiBackend.java index 3578f99..56b5a3e 100644 --- a/src/jexer/backend/MultiBackend.java +++ b/src/jexer/backend/MultiBackend.java @@ -111,7 +111,10 @@ public class MultiBackend implements Backend { * screen to the physical device. */ public void flushScreen() { - for (Backend backend: backends) { + multiScreen.flushPhysical(); + int n = backends.size(); + for (int i = 0; i < n; i++) { + Backend backend = backends.get(Math.min(i, backends.size())); backend.flushScreen(); } } diff --git a/src/jexer/backend/MultiScreen.java b/src/jexer/backend/MultiScreen.java index c735961..f113094 100644 --- a/src/jexer/backend/MultiScreen.java +++ b/src/jexer/backend/MultiScreen.java @@ -39,475 +39,74 @@ import jexer.bits.Clipboard; /** * MultiScreen mirrors its I/O to several screens. */ -public class MultiScreen implements Screen { +public class MultiScreen extends LogicalScreen implements Screen { // ------------------------------------------------------------------------ // Variables -------------------------------------------------------------- // ------------------------------------------------------------------------ - /** - * The backend associated with this screen. - */ - private Backend backend; - /** * The list of screens to use. */ private List screens = new ArrayList(); + /** + * The text cell width in pixels to report. + */ + private int textWidth = 10; + + /** + * The text cell height in pixels to report. + */ + private int textHeight = 20; + // ------------------------------------------------------------------------ // Constructors ----------------------------------------------------------- // ------------------------------------------------------------------------ /** - * Public constructor requires one screen. + * Public constructor provides a virtual screen at 80x25. + */ + public MultiScreen() { + super(80, 25); + } + + /** + * Public constructor takes the dimensions of the first screen. * * @param screen the screen to add */ public MultiScreen(final Screen screen) { + super(screen.getWidth(), screen.getHeight()); synchronized (screens) { screens.add(screen); + this.textWidth = screen.getTextWidth(); + this.textHeight = screen.getTextHeight(); } } // ------------------------------------------------------------------------ - // Screen ----------------------------------------------------------------- + // LogicalScreen ---------------------------------------------------------- // ------------------------------------------------------------------------ /** - * Set drawing offset for x. + * Get the width of a character cell in pixels. * - * @param offsetX new drawing offset + * @return the width in pixels of a character cell */ - public void setOffsetX(final int offsetX) { - synchronized (screens) { - for (Screen screen: screens) { - screen.setOffsetX(offsetX); - } - } + @Override + public int getTextWidth() { + return textWidth; } /** - * Get drawing offset for x. + * Get the height of a character cell in pixels. * - * @return the drawing offset + * @return the height in pixels of a character cell */ - public int getOffsetX() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getOffsetX(); - } - return 0; - } - } - - /** - * Set drawing offset for y. - * - * @param offsetY new drawing offset - */ - public void setOffsetY(final int offsetY) { - synchronized (screens) { - for (Screen screen: screens) { - screen.setOffsetY(offsetY); - } - } - } - - /** - * Get drawing offset for y. - * - * @return the drawing offset - */ - public int getOffsetY() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getOffsetY(); - } - return 0; - } - } - - /** - * Get right drawing clipping boundary. - * - * @return drawing boundary - */ - public int getClipRight() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getClipRight(); - } - return 0; - } - } - - /** - * Set right drawing clipping boundary. - * - * @param clipRight new boundary - */ - public void setClipRight(final int clipRight) { - synchronized (screens) { - for (Screen screen: screens) { - screen.setClipRight(clipRight); - } - } - } - - /** - * Get bottom drawing clipping boundary. - * - * @return drawing boundary - */ - public int getClipBottom() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getClipBottom(); - } - return 0; - } - } - - /** - * Set bottom drawing clipping boundary. - * - * @param clipBottom new boundary - */ - public void setClipBottom(final int clipBottom) { - synchronized (screens) { - for (Screen screen: screens) { - screen.setClipBottom(clipBottom); - } - } - } - - /** - * Get left drawing clipping boundary. - * - * @return drawing boundary - */ - public int getClipLeft() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getClipLeft(); - } - return 0; - } - } - - /** - * Set left drawing clipping boundary. - * - * @param clipLeft new boundary - */ - public void setClipLeft(final int clipLeft) { - synchronized (screens) { - for (Screen screen: screens) { - screen.setClipLeft(clipLeft); - } - } - } - - /** - * Get top drawing clipping boundary. - * - * @return drawing boundary - */ - public int getClipTop() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getClipTop(); - } - return 0; - } - } - - /** - * Set top drawing clipping boundary. - * - * @param clipTop new boundary - */ - public void setClipTop(final int clipTop) { - synchronized (screens) { - for (Screen screen: screens) { - screen.setClipTop(clipTop); - } - } - } - - /** - * Get dirty flag. - * - * @return if true, the logical screen is not in sync with the physical - * screen - */ - public boolean isDirty() { - synchronized (screens) { - for (Screen screen: screens) { - if (screen.isDirty()) { - return true; - } - } - return false; - } - } - - /** - * Get the attributes at one location. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @return attributes at (x, y) - */ - public CellAttributes getAttrXY(final int x, final int y) { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getAttrXY(x, y); - } - return new CellAttributes(); - } - } - - /** - * Get the cell at one location. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @return the character + attributes - */ - public Cell getCharXY(final int x, final int y) { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getCharXY(x, y); - } - return new Cell(); - } - } - - /** - * Get the cell at one location, in either absolute or clipped - * coordinates. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param clip if true, honor clipping/offset - * - * @return the character + attributes, or null if this position is - * outside the clipping/offset region - */ - public Cell getCharXY(final int x, final int y, final boolean clip) { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getCharXY(x, y, clip); - } - return null; - } - } - - /** - * Set the attributes at one location. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param attr attributes to use (bold, foreColor, backColor) - */ - public void putAttrXY(final int x, final int y, - final CellAttributes attr) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.putAttrXY(x, y, attr); - } - } - } - - /** - * Set the attributes at one location. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param attr attributes to use (bold, foreColor, backColor) - * @param clip if true, honor clipping/offset - */ - public void putAttrXY(final int x, final int y, - final CellAttributes attr, final boolean clip) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.putAttrXY(x, y, attr, clip); - } - } - } - - /** - * Fill the entire screen with one character with attributes. - * - * @param ch character to draw - * @param attr attributes to use (bold, foreColor, backColor) - */ - public void putAll(final int ch, final CellAttributes attr) { - synchronized (screens) { - for (Screen screen: screens) { - screen.putAll(ch, attr); - } - } - } - - /** - * Render one character with attributes. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param ch character + attributes to draw - */ - public void putCharXY(final int x, final int y, final Cell ch) { - synchronized (screens) { - for (Screen screen: screens) { - screen.putCharXY(x, y, ch); - } - } - } - - /** - * Render one character with attributes. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param ch character to draw - * @param attr attributes to use (bold, foreColor, backColor) - */ - public void putCharXY(final int x, final int y, final int ch, - final CellAttributes attr) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.putCharXY(x, y, ch, attr); - } - } - } - - /** - * Render one character without changing the underlying attributes. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param ch character to draw - */ - public void putCharXY(final int x, final int y, final int ch) { - synchronized (screens) { - for (Screen screen: screens) { - screen.putCharXY(x, y, ch); - } - } - } - - /** - * Render a string. Does not wrap if the string exceeds the line. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param str string to draw - * @param attr attributes to use (bold, foreColor, backColor) - */ - public void putStringXY(final int x, final int y, final String str, - final CellAttributes attr) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.putStringXY(x, y, str, attr); - } - } - } - - /** - * Render a string without changing the underlying attribute. Does not - * wrap if the string exceeds the line. - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param str string to draw - */ - public void putStringXY(final int x, final int y, final String str) { - synchronized (screens) { - for (Screen screen: screens) { - screen.putStringXY(x, y, str); - } - } - } - - /** - * Draw a vertical line from (x, y) to (x, y + n). - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param n number of characters to draw - * @param ch character to draw - * @param attr attributes to use (bold, foreColor, backColor) - */ - public void vLineXY(final int x, final int y, final int n, - final int ch, final CellAttributes attr) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.vLineXY(x, y, n, ch, attr); - } - } - } - - /** - * Draw a vertical line from (x, y) to (x, y + n). - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param n number of characters to draw - * @param ch character to draw - */ - public void vLineXY(final int x, final int y, final int n, - final Cell ch) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.vLineXY(x, y, n, ch); - } - } - } - - /** - * Draw a horizontal line from (x, y) to (x + n, y). - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param n number of characters to draw - * @param ch character to draw - * @param attr attributes to use (bold, foreColor, backColor) - */ - public void hLineXY(final int x, final int y, final int n, - final int ch, final CellAttributes attr) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.hLineXY(x, y, n, ch, attr); - } - } - } - - /** - * Draw a horizontal line from (x, y) to (x + n, y). - * - * @param x column coordinate. 0 is the left-most column. - * @param y row coordinate. 0 is the top-most row. - * @param n number of characters to draw - * @param ch character to draw - */ - public void hLineXY(final int x, final int y, final int n, - final Cell ch) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.hLineXY(x, y, n, ch); - } - } + @Override + public int getTextHeight() { + return textHeight; } /** @@ -516,7 +115,9 @@ public class MultiScreen implements Screen { * * @param width new screen width */ + @Override public void setWidth(final int width) { + super.setWidth(width); synchronized (screens) { for (Screen screen: screens) { screen.setWidth(width); @@ -530,7 +131,9 @@ public class MultiScreen implements Screen { * * @param height new screen height */ + @Override public void setHeight(final int height) { + super.setHeight(height); synchronized (screens) { for (Screen screen: screens) { screen.setHeight(height); @@ -545,7 +148,9 @@ public class MultiScreen implements Screen { * @param width new screen width * @param height new screen height */ + @Override public void setDimensions(final int width, final int height) { + super.setDimensions(width, height); synchronized (screens) { for (Screen screen: screens) { // Do not blindly call setDimension() on every screen. @@ -566,150 +171,12 @@ public class MultiScreen implements Screen { } } - /** - * Get the height. - * - * @return current screen height - */ - public int getHeight() { - // Return the smallest height of the screens. - int height = 25; - synchronized (screens) { - if (screens.size() > 0) { - height = screens.get(0).getHeight(); - } - for (Screen screen: screens) { - if (screen.getHeight() < height) { - height = screen.getHeight(); - } - } - return height; - } - } - - /** - * Get the width. - * - * @return current screen width - */ - public int getWidth() { - // Return the smallest width of the screens. - int width = 80; - synchronized (screens) { - if (screens.size() > 0) { - width = screens.get(0).getWidth(); - } - for (Screen screen: screens) { - if (screen.getWidth() < width) { - width = screen.getWidth(); - } - } - return width; - } - } - - /** - * Reset screen to not-bold, white-on-black. Also flushes the offset and - * clip variables. - */ - public void reset() { - synchronized (screens) { - for (Screen screen: screens) { - screen.reset(); - } - } - } - - /** - * Flush the offset and clip variables. - */ - public void resetClipping() { - synchronized (screens) { - for (Screen screen: screens) { - screen.resetClipping(); - } - } - } - - /** - * Clear the logical screen. - */ - public void clear() { - synchronized (screens) { - for (Screen screen: screens) { - screen.clear(); - } - } - } - - /** - * Draw a box with a border and empty background. - * - * @param left left column of box. 0 is the left-most column. - * @param top top row of the box. 0 is the top-most row. - * @param right right column of box - * @param bottom bottom row of the box - * @param border attributes to use for the border - * @param background attributes to use for the background - */ - public void drawBox(final int left, final int top, - final int right, final int bottom, - final CellAttributes border, final CellAttributes background) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.drawBox(left, top, right, bottom, border, background); - } - } - } - - /** - * Draw a box with a border and empty background. - * - * @param left left column of box. 0 is the left-most column. - * @param top top row of the box. 0 is the top-most row. - * @param right right column of box - * @param bottom bottom row of the box - * @param border attributes to use for the border - * @param background attributes to use for the background - * @param borderStyle style of border - * @param shadow if true, draw a "shadow" on the box - */ - public void drawBox(final int left, final int top, - final int right, final int bottom, - final CellAttributes border, final CellAttributes background, - final BorderStyle borderStyle, final boolean shadow) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.drawBox(left, top, right, bottom, border, background, - borderStyle, shadow); - } - } - } - - /** - * Draw a box shadow. - * - * @param left left column of box. 0 is the left-most column. - * @param top top row of the box. 0 is the top-most row. - * @param right right column of box - * @param bottom bottom row of the box - */ - public void drawBoxShadow(final int left, final int top, - final int right, final int bottom) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.drawBoxShadow(left, top, right, bottom); - } - } - } - /** * Clear the physical screen. */ + @Override public void clearPhysical() { + super.clearPhysical(); synchronized (screens) { for (Screen screen: screens) { screen.clearPhysical(); @@ -717,106 +184,31 @@ public class MultiScreen implements Screen { } } - /** - * Unset every image cell on one row of the physical screen, forcing - * images on that row to be redrawn. - * - * @param y row coordinate. 0 is the top-most row. - */ - public final void unsetImageRow(final int y) { - synchronized (screens) { - for (Screen screen: screens) { - screen.unsetImageRow(y); - } - } - } - /** * Classes must provide an implementation to push the logical screen to * the physical device. */ + @Override public void flushPhysical() { + List screensToFlush = new ArrayList(); synchronized (screens) { - for (Screen screen: screens) { - screen.flushPhysical(); - } + screensToFlush.addAll(screens); } - } - - /** - * Put the cursor at (x,y). - * - * @param visible if true, the cursor should be visible - * @param x column coordinate to put the cursor on - * @param y row coordinate to put the cursor on - */ - public void putCursor(final boolean visible, final int x, final int y) { - synchronized (screens) { - for (Screen screen: screens) { - screen.putCursor(visible, x, y); + for (Screen screen: screensToFlush) { + synchronized (screen) { + screen.copyScreen(this); } } } - /** - * Hide the cursor. - */ - public void hideCursor() { - synchronized (screens) { - for (Screen screen: screens) { - screen.hideCursor(); - } - } - } - - /** - * Get the cursor visibility. - * - * @return true if the cursor is visible - */ - public boolean isCursorVisible() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).isCursorVisible(); - } - return true; - } - } - - /** - * Get the cursor X position. - * - * @return the cursor x column position - */ - public int getCursorX() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getCursorX(); - } - return 0; - } - } - - /** - * Get the cursor Y position. - * - * @return the cursor y row position - */ - public int getCursorY() { - synchronized (screens) { - if (screens.size() > 0) { - return screens.get(0).getCursorY(); - } - return 0; - } - } - /** * Set the window title. * * @param title the new title */ + @Override public void setTitle(final String title) { + super.setTitle(title); synchronized (screens) { for (Screen screen: screens) { screen.setTitle(title); @@ -837,284 +229,25 @@ public class MultiScreen implements Screen { synchronized (screens) { screens.add(screen); } + textWidth = Math.min(textWidth, screen.getTextWidth()); + textHeight = Math.min(textHeight, screen.getTextHeight()); } /** * Remove a screen from the list. * - * @param screen the screen to remove + * @param screenToRemove the screen to remove */ - public void removeScreen(final Screen screen) { + public void removeScreen(final Screen screenToRemove) { synchronized (screens) { if (screens.size() > 1) { - screens.remove(screen); + screens.remove(screenToRemove); } - } - } - - /** - * Get the width of a character cell in pixels. - * - * @return the width in pixels of a character cell - */ - public int getTextWidth() { - int textWidth = 10; - synchronized (screens) { for (Screen screen: screens) { - int newTextWidth = screen.getTextWidth(); - if (newTextWidth < textWidth) { - textWidth = newTextWidth; - } - } - return textWidth; - } - } - - /** - * Get the height of a character cell in pixels. - * - * @return the height in pixels of a character cell - */ - public int getTextHeight() { - int textHeight = 20; - synchronized (screens) { - for (Screen screen: screens) { - int newTextHeight = screen.getTextHeight(); - if (newTextHeight < textHeight) { - textHeight = newTextHeight; - } - } - return textHeight; - } - } - - /** - * Invert the cell color at a position, including both halves of a - * double-width cell. - * - * @param x column position - * @param y row position - */ - public void invertCell(final int x, final int y) { - synchronized (screens) { - for (Screen screen: screens) { - screen.invertCell(x, y); + textWidth = Math.min(textWidth, screen.getTextWidth()); + textHeight = Math.min(textHeight, screen.getTextHeight()); } } } - /** - * Invert the cell color at a position. - * - * @param x column position - * @param y row position - * @param onlyThisCell if true, only invert this cell, otherwise invert - * both halves of a double-width cell if necessary - */ - public void invertCell(final int x, final int y, - final boolean onlyThisCell) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.invertCell(x, y, onlyThisCell); - } - } - } - - /** - * Set a selection area on the screen. - * - * @param x0 the starting X position of the selection - * @param y0 the starting Y position of the selection - * @param x1 the ending X position of the selection - * @param y1 the ending Y position of the selection - * @param rectangle if true, this is a rectangle select - */ - public void setSelection(final int x0, final int y0, - final int x1, final int y1, final boolean rectangle) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.setSelection(x0, y0, x1, y1, rectangle); - } - } - } - - /** - * Copy the screen selection area to the clipboard. - * - * @param clipboard the clipboard to use - * @param x0 the starting X position of the selection - * @param y0 the starting Y position of the selection - * @param x1 the ending X position of the selection - * @param y1 the ending Y position of the selection - * @param rectangle if true, this is a rectangle select - */ - public void copySelection(final Clipboard clipboard, - final int x0, final int y0, final int x1, final int y1, - final boolean rectangle) { - - synchronized (screens) { - // Only copy from the first screen. - if (screens.size() > 0) { - screens.get(0).copySelection(clipboard, x0, y0, x1, y1, - rectangle); - } - } - } - - /** - * Obtain a snapshot copy of the screen. - * - * @return a copy of the screen's data - */ - public Screen snapshot() { - synchronized (screens) { - // Only copy from the first screen. - if (screens.size() > 0) { - return screens.get(0).snapshot(); - } - - // No screens are defined, create a blank. - - LogicalScreen other = null; - - other = new LogicalScreen(); - int width = 80; - int height = 25; - other.setDimensions(width, height); - return other; - } - } - - /** - * Obtain a snapshot copy of a rectangular portion of the screen. - * - * @param x left column of rectangle. 0 is the left-most column. - * @param y top row of the rectangle. 0 is the top-most row. - * @param width number of columns to copy - * @param height number of rows to copy - * @return a copy of the screen's data from this rectangle. Any cells - * outside the actual screen dimensions will be blank. - */ - public Screen snapshot(final int x, final int y, final int width, - final int height) { - - synchronized (screens) { - // Only copy from the first screen. - if (screens.size() > 0) { - return screens.get(0).snapshot(x, y, width, height); - } - - // No screens are defined, create a blank. - - LogicalScreen other = null; - - other = new LogicalScreen(); - int newWidth = x + width; - int newHeight = y + 25; - other.setDimensions(newWidth, newHeight); - return other; - } - } - - /** - * Copy all of screen's data to this screen. - * - * @param other the other screen - */ - public void copyScreen(final Screen other) { - synchronized (screens) { - for (Screen screen: screens) { - screen.copyScreen(other); - } - } - } - - /** - * Copy a rectangular portion of another screen to this one. Any cells - * outside this screen's dimensions will be ignored. - * - * @param other the other screen - * @param x left column of rectangle. 0 is the left-most column. - * @param y top row of the rectangle. 0 is the top-most row. - * @param width number of columns to copy - * @param height number of rows to copy - */ - public void copyScreen(final Screen other, final int x, final int y, - final int width, final int height) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.copyScreen(other, x, y, width, height); - } - } - } - - /** - * Alpha-blend a rectangular portion of another screen onto this one. - * Any cells outside this screen's dimensions will be ignored. - * - * @param otherScreen the other screen - * @param x left column of rectangle. 0 is the left-most column. - * @param y top row of the rectangle. 0 is the top-most row. - * @param width number of columns to copy - * @param height number of rows to copy - * @param alpha the alpha transparency level (0 - 255) to use for cells - * from the other screen - * @param filterHatch if true, prevent hatch-like characters from - * showing through - */ - public void blendScreen(final Screen otherScreen, final int x, final int y, - final int width, final int height, final int alpha, - final boolean filterHatch) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.blendScreen(otherScreen, x, y, width, height, alpha, - filterHatch); - } - } - } - - /** - * Alpha-blend a rectangle with a specified color and alpha onto this - * screen. Any cells outside this screen's dimensions will be ignored. - * - * @param x left column of rectangle. 0 is the left-most column. - * @param y top row of the rectangle. 0 is the top-most row. - * @param width number of columns to copy - * @param height number of rows to copy - * @param color the RGB color to blend - * @param alpha the alpha transparency level (0 - 255) to use for cells - * from the other screen - */ - public void blendRectangle(final int x, final int y, - final int width, final int height, final int color, final int alpha) { - - synchronized (screens) { - for (Screen screen: screens) { - screen.blendRectangle(x, y, width, height, color, alpha); - } - } - } - - /** - * Set the backend to associated with this screen. - * - * @param backend the backend - */ - public final void setBackend(final Backend backend) { - this.backend = backend; - } - - /** - * Get the backend that instantiated this screen. - * - * @return the backend - */ - public final Backend getBackend() { - return backend; - } - }