Package lejos.remote.ev3
Class RemoteRequestGraphicsLCD
- java.lang.Object
-
- lejos.remote.ev3.RemoteRequestGraphicsLCD
-
- All Implemented Interfaces:
CommonLCD,GraphicsLCD
public class RemoteRequestGraphicsLCD extends java.lang.Object implements GraphicsLCD
-
-
Field Summary
-
Fields inherited from interface lejos.hardware.lcd.CommonLCD
ROP_AND, ROP_ANDINVERTED, ROP_ANDREVERSE, ROP_CLEAR, ROP_COPY, ROP_COPYINVERTED, ROP_EQUIV, ROP_INVERT, ROP_NAND, ROP_NOOP, ROP_NOR, ROP_OR, ROP_ORINVERTED, ROP_ORREVERSE, ROP_SET, ROP_XOR
-
Fields inherited from interface lejos.hardware.lcd.GraphicsLCD
BASELINE, BLACK, BOTTOM, DOTTED, HCENTER, LEFT, RIGHT, SOLID, TOP, TRANS_MIRROR, TRANS_MIRROR_ROT180, TRANS_MIRROR_ROT270, TRANS_MIRROR_ROT90, TRANS_NONE, TRANS_ROT180, TRANS_ROT270, TRANS_ROT90, VCENTER, WHITE
-
-
Constructor Summary
Constructors Constructor Description RemoteRequestGraphicsLCD(java.io.ObjectInputStream is, java.io.ObjectOutputStream os)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbitBlt(byte[] src, int sw, int sh, int sx, int sy, byte[] dst, int dw, int dh, int dx, int dy, int w, int h, int rop)Standard two input BitBlt function.voidbitBlt(byte[] src, int sw, int sh, int sx, int sy, int dx, int dy, int w, int h, int rop)Standard two input BitBlt function with the LCD display as the destination.voidclear()Clear the display.voidcopyArea(int sx, int sy, int w, int h, int x, int y, int anchor)Copy one rectangular area of the drawing surface to another.voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle)Draw an arc, using the current color and style.voiddrawChar(char character, int x, int y, int anchor)Draw a single character to the graphics surface using the current color.voiddrawChars(char[] data, int offset, int length, int x, int y, int anchor)Draw a series of characters to the graphics surface using the current color.voiddrawImage(Image src, int x, int y, int anchor)Draw the specified image to the graphics surface, using the supplied rop.voiddrawLine(int x0, int y0, int x1, int y1)Draw a line between the specified points, using the current color and style.voiddrawRect(int x, int y, int width, int height)Draw a rectangle using the current color and style.voiddrawRegion(Image src, int sx, int sy, int w, int h, int transform, int x, int y, int anchor)Draw the specified region of the supplied image to the graphics surface.voiddrawRegionRop(Image src, int sx, int sy, int w, int h, int x, int y, int anchor, int rop)Draw the specified image to the graphics surface, using the supplied rop.voiddrawRegionRop(Image src, int sx, int sy, int w, int h, int transform, int x, int y, int anchor, int rop)Draw the specified region of the source image to the graphics surface after applying the requested transformation, use the supplied rop.voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)Draw a rounded rectangle.voiddrawString(java.lang.String str, int x, int y, int anchor)Draws the specified String using the current font and color.voiddrawString(java.lang.String str, int x, int y, int anchor, boolean inverted)Draws the specified String using the current font and color.voiddrawSubstring(java.lang.String str, int offset, int len, int x, int y, int anchor)Draw a substring to the graphics surface using the current color.voidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle)Draw a filled arc, using the current color.voidfillRect(int x, int y, int w, int h)Draw a filled rectangle using the current color.byte[]getDisplay()Provide access to the LCD display frame buffer.FontgetFont()Return the currently selected font object.intgetHeight()Return the height of the associated drawing surface.byte[]getHWDisplay()Get access to hardware LCD display.intgetPixel(int x, int y)Method to get a pixel from the screen.intgetStrokeStyle()Return the current stroke style.intgetTranslateX()Gets the X coordinate of the translated origin of this graphics context.intgetTranslateY()Gets the Y coordinate of the translated origin of this graphics context.intgetWidth()Return the width of the associated drawing surface.voidrefresh()Refresh the display.voidsetAutoRefresh(boolean on)Turn on/off the automatic refresh of the LCD display.intsetAutoRefreshPeriod(int period)Set the period used to perform automatic refreshing of the display.voidsetColor(int rgb)Set the current drawing color.voidsetColor(int red, int green, int blue)Sets the current color to the specified RGB values.voidsetContrast(int contrast)Set the LCD contrast.voidsetFont(Font f)Set the current fontvoidsetPixel(int x, int y, int color)Method to set a pixel on the screen.voidsetStrokeStyle(int style)Set the stroke style to be used for drawing operations.voidtranslate(int x, int y)Translates the origin of the graphics context to the point (x, y) in the current coordinate system.
-
-
-
Method Detail
-
refresh
public void refresh()
Description copied from interface:CommonLCDRefresh the display. If auto refresh is off, this method will wait until the display refresh has completed. If auto refresh is on it will return immediately.
-
clear
public void clear()
Description copied from interface:CommonLCDClear the display.
-
getWidth
public int getWidth()
Description copied from interface:CommonLCDReturn the width of the associated drawing surface.
Note: This is a non standard method.
-
getHeight
public int getHeight()
Description copied from interface:CommonLCDReturn the height of the associated drawing surface.
Note: This is a non standard method.
-
getDisplay
public byte[] getDisplay()
Description copied from interface:CommonLCDProvide access to the LCD display frame buffer.- Specified by:
getDisplayin interfaceCommonLCD- Returns:
- byte array that is the frame buffer.
-
getHWDisplay
public byte[] getHWDisplay()
Description copied from interface:CommonLCDGet access to hardware LCD display.- Specified by:
getHWDisplayin interfaceCommonLCD- Returns:
- byte array that is the frame buffer
-
setContrast
public void setContrast(int contrast)
Description copied from interface:CommonLCDSet the LCD contrast.- Specified by:
setContrastin interfaceCommonLCD- Parameters:
contrast- 0 blank 0x60 full on
-
bitBlt
public void bitBlt(byte[] src, int sw, int sh, int sx, int sy, int dx, int dy, int w, int h, int rop)Description copied from interface:CommonLCDStandard two input BitBlt function with the LCD display as the destination. Supports standard raster ops and overlapping images. Images are held in native leJOS/Lego format.- Specified by:
bitBltin interfaceCommonLCD- Parameters:
src- byte array containing the source imagesw- Width of the source imagesh- Height of the source imagesx- X position to start the copy fromsy- Y Position to start the copy fromdx- X destinationdy- Y destinationw- width of the area to copyh- height of the area to copyrop- raster operation.
-
bitBlt
public void bitBlt(byte[] src, int sw, int sh, int sx, int sy, byte[] dst, int dw, int dh, int dx, int dy, int w, int h, int rop)Description copied from interface:CommonLCDStandard two input BitBlt function. Supports standard raster ops and overlapping images. Images are held in native leJOS/Lego format.- Specified by:
bitBltin interfaceCommonLCD- Parameters:
src- byte array containing the source imagesw- Width of the source imagesh- Height of the source imagesx- X position to start the copy fromsy- Y Position to start the copy fromdst- byte array containing the destination imagedw- Width of the destination imagedh- Height of the destination imagedx- X destinationdy- Y destinationw- width of the area to copyh- height of the area to copyrop- raster operation.
-
setAutoRefresh
public void setAutoRefresh(boolean on)
Description copied from interface:CommonLCDTurn on/off the automatic refresh of the LCD display. At system startup auto refresh is on.- Specified by:
setAutoRefreshin interfaceCommonLCD- Parameters:
on- true to enable, false to disable
-
setAutoRefreshPeriod
public int setAutoRefreshPeriod(int period)
Description copied from interface:CommonLCDSet the period used to perform automatic refreshing of the display. A period of 0 disables the refresh.- Specified by:
setAutoRefreshPeriodin interfaceCommonLCD- Parameters:
period- time in ms- Returns:
- the previous refresh period.
-
setPixel
public void setPixel(int x, int y, int color)Description copied from interface:GraphicsLCDMethod to set a pixel on the screen.- Specified by:
setPixelin interfaceGraphicsLCD- Parameters:
x- the x coordinatey- the y coordinatecolor- the pixel color (0 = white, 1 = black)
-
getPixel
public int getPixel(int x, int y)Description copied from interface:GraphicsLCDMethod to get a pixel from the screen.- Specified by:
getPixelin interfaceGraphicsLCD- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the pixel color (0 = white, 1 = black)
-
drawString
public void drawString(java.lang.String str, int x, int y, int anchor, boolean inverted)Description copied from interface:GraphicsLCDDraws the specified String using the current font and color. x and y give the location of the anchor point. Additional method to allow for the easy use of inverted text. In this case the area below the string is drawn in the current color, before drawing the text in the "inverted" color.
Note: This is a non standard method.- Specified by:
drawStringin interfaceGraphicsLCD- Parameters:
str- the String to be drawnx- the x coordinate of the anchor pointy- the y coordinate of the anchor pointanchor- the anchor point for positioning the textinverted- true to invert the text display.
-
drawString
public void drawString(java.lang.String str, int x, int y, int anchor)Description copied from interface:GraphicsLCDDraws the specified String using the current font and color. x and y give the location of the anchor point.- Specified by:
drawStringin interfaceGraphicsLCD- Parameters:
str- the String to be drawnx- the x coordinate of the anchor pointy- the y coordinate of the anchor pointanchor- the anchor point for positioning the text
-
drawSubstring
public void drawSubstring(java.lang.String str, int offset, int len, int x, int y, int anchor)Description copied from interface:GraphicsLCDDraw a substring to the graphics surface using the current color.- Specified by:
drawSubstringin interfaceGraphicsLCD- Parameters:
str- the base stringoffset- the start of the sub stringlen- the length of the sub stringx- the x coordinate of the anchor pointy- the x coordinate of the anchor pointanchor- the anchor point used to position the text.
-
drawChar
public void drawChar(char character, int x, int y, int anchor)Description copied from interface:GraphicsLCDDraw a single character to the graphics surface using the current color.- Specified by:
drawCharin interfaceGraphicsLCD- Parameters:
character- the character to drawx- the x coordinate of the anchor pointy- the x coordinate of the anchor pointanchor- the anchor point used to position the text.
-
drawChars
public void drawChars(char[] data, int offset, int length, int x, int y, int anchor)Description copied from interface:GraphicsLCDDraw a series of characters to the graphics surface using the current color.- Specified by:
drawCharsin interfaceGraphicsLCD- Parameters:
data- the charactersoffset- the start of the characters to be drawnlength- the length of the character string to drawx- the x coordinate of the anchor pointy- the x coordinate of the anchor pointanchor- the anchor point used to position the text.
-
getStrokeStyle
public int getStrokeStyle()
Description copied from interface:GraphicsLCDReturn the current stroke style.- Specified by:
getStrokeStylein interfaceGraphicsLCD- Returns:
- current style.
-
setStrokeStyle
public void setStrokeStyle(int style)
Description copied from interface:GraphicsLCDSet the stroke style to be used for drawing operations.- Specified by:
setStrokeStylein interfaceGraphicsLCD- Parameters:
style- new style.
-
drawRegionRop
public void drawRegionRop(Image src, int sx, int sy, int w, int h, int x, int y, int anchor, int rop)
Description copied from interface:GraphicsLCDDraw the specified image to the graphics surface, using the supplied rop.
Note: This is a non standard method. Added because without it, it is very hard to invert/manipulate an image, or screen region- Specified by:
drawRegionRopin interfaceGraphicsLCD- Parameters:
src- image to draw (may be null for ops that do not require input.sx- x offset in the sourcesy- y offset in the sourcew- width of area to drawh- height of area to draw.x- destinationy- destinationanchor- location of the anchor pointrop- drawing operation.- See Also:
Image
-
drawRegionRop
public void drawRegionRop(Image src, int sx, int sy, int w, int h, int transform, int x, int y, int anchor, int rop)
Description copied from interface:GraphicsLCDDraw the specified region of the source image to the graphics surface after applying the requested transformation, use the supplied rop.
NOTE: When calculating the anchor point this method assumes that a transformed version of the source width/height should be used.- Specified by:
drawRegionRopin interfaceGraphicsLCD- Parameters:
src- The source imagesx- x coordinate of the regionsy- y coordinate of the regionw- width of the regionh- height of the regiontransform- the required transformx- x coordinate of the anchor pointy- y coordinate of the anchor pointanchor- type of anchorrop- raster operation used to draw the output.
-
drawRegion
public void drawRegion(Image src, int sx, int sy, int w, int h, int transform, int x, int y, int anchor)
Description copied from interface:GraphicsLCDDraw the specified region of the supplied image to the graphics surface. NOTE: Transforms are not currently supported.- Specified by:
drawRegionin interfaceGraphicsLCD- Parameters:
src- image to draw (may be null for ops that do not require input.sx- x offset to the regionsy- y offset to the regionw- width of the regionh- height of the regionx- destinationy- destinationanchor- location of the anchor point- See Also:
Image
-
drawImage
public void drawImage(Image src, int x, int y, int anchor)
Description copied from interface:GraphicsLCDDraw the specified image to the graphics surface, using the supplied rop.- Specified by:
drawImagein interfaceGraphicsLCD- Parameters:
src- image to draw (may be null for ops that do not require input.x- destinationy- destinationanchor- location of the anchor point- See Also:
Image
-
drawLine
public void drawLine(int x0, int y0, int x1, int y1)Description copied from interface:GraphicsLCDDraw a line between the specified points, using the current color and style.- Specified by:
drawLinein interfaceGraphicsLCD- Parameters:
x0- x start pointy0- y start pointx1- x end pointy1- y end point
-
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)Description copied from interface:GraphicsLCDDraw an arc, using the current color and style.- Specified by:
drawArcin interfaceGraphicsLCD
-
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)Description copied from interface:GraphicsLCDDraw a filled arc, using the current color.- Specified by:
fillArcin interfaceGraphicsLCD
-
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)Description copied from interface:GraphicsLCDDraw a rounded rectangle.- Specified by:
drawRoundRectin interfaceGraphicsLCD
-
drawRect
public void drawRect(int x, int y, int width, int height)Description copied from interface:GraphicsLCDDraw a rectangle using the current color and style.- Specified by:
drawRectin interfaceGraphicsLCD
-
fillRect
public void fillRect(int x, int y, int w, int h)Description copied from interface:GraphicsLCDDraw a filled rectangle using the current color.- Specified by:
fillRectin interfaceGraphicsLCD
-
copyArea
public void copyArea(int sx, int sy, int w, int h, int x, int y, int anchor)Description copied from interface:GraphicsLCDCopy one rectangular area of the drawing surface to another.- Specified by:
copyAreain interfaceGraphicsLCD- Parameters:
sx- Source xsy- Source yw- Source widthh- Source heightx- Destination xy- Destination yanchor- location of the anchor point of the destination.
-
getFont
public Font getFont()
Description copied from interface:GraphicsLCDReturn the currently selected font object.- Specified by:
getFontin interfaceGraphicsLCD- Returns:
- Current font.
-
setFont
public void setFont(Font f)
Description copied from interface:GraphicsLCDSet the current font- Specified by:
setFontin interfaceGraphicsLCD- Parameters:
f- the font
-
translate
public void translate(int x, int y)Description copied from interface:GraphicsLCDTranslates the origin of the graphics context to the point (x, y) in the current coordinate system. Calls are cumulative.- Specified by:
translatein interfaceGraphicsLCD- Parameters:
x- the new translation origin x valuey- new translation origin y value- See Also:
GraphicsLCD.getTranslateX(),GraphicsLCD.getTranslateY()
-
getTranslateX
public int getTranslateX()
Description copied from interface:GraphicsLCDGets the X coordinate of the translated origin of this graphics context.- Specified by:
getTranslateXin interfaceGraphicsLCD- Returns:
- X of current origin
-
getTranslateY
public int getTranslateY()
Description copied from interface:GraphicsLCDGets the Y coordinate of the translated origin of this graphics context.- Specified by:
getTranslateYin interfaceGraphicsLCD- Returns:
- Y of current origin
-
setColor
public void setColor(int rgb)
Description copied from interface:GraphicsLCDSet the current drawing color. The value is in the format 0x00RRGGBB. NOTE. Currently only black and white is supported. any non black color is treated as white!- Specified by:
setColorin interfaceGraphicsLCD- Parameters:
rgb- new color.
-
setColor
public void setColor(int red, int green, int blue)Description copied from interface:GraphicsLCDSets the current color to the specified RGB values.- Specified by:
setColorin interfaceGraphicsLCD- Parameters:
red- the red componentgreen- the green componentblue- the blue
-
-