Package lejos.hardware.lcd
Interface GraphicsLCD
-
- All Superinterfaces:
CommonLCD
- All Known Implementing Classes:
RemoteGraphicsLCD,RemoteRequestGraphicsLCD
public interface GraphicsLCD extends CommonLCD
-
-
Field Summary
Fields Modifier and Type Field Description static intBASELINEPosition the anchor point at the baseline of text.static intBLACKstatic intBOTTOMPosition the anchor point of text and images below the text or image.static intDOTTEDConstant for theDOTTEDstroke style.static intHCENTERCentering text and images horizontally around the anchor pointstatic intLEFTPosition the anchor point of text and images to the left of the text or image.static intRIGHTPosition the anchor point of text and images to the right of the text or image.static intSOLIDConstant for theSOLIDstroke style.static intTOPPosition the anchor point of text and images above the text or image.static intTRANS_MIRRORstatic intTRANS_MIRROR_ROT180static intTRANS_MIRROR_ROT270static intTRANS_MIRROR_ROT90static intTRANS_NONEstatic intTRANS_ROT180static intTRANS_ROT270static intTRANS_ROT90static intVCENTERCentering images vertically around the anchor point.static intWHITE-
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.FontgetFont()Return the currently selected font object.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.voidsetColor(int rgb)Set the current drawing color.voidsetColor(int red, int green, int blue)Sets the current color to the specified RGB values.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.-
Methods inherited from interface lejos.hardware.lcd.CommonLCD
bitBlt, bitBlt, clear, getDisplay, getHeight, getHWDisplay, getWidth, refresh, setAutoRefresh, setAutoRefreshPeriod, setContrast
-
-
-
-
Field Detail
-
TRANS_MIRROR
static final int TRANS_MIRROR
- See Also:
- Constant Field Values
-
TRANS_MIRROR_ROT180
static final int TRANS_MIRROR_ROT180
- See Also:
- Constant Field Values
-
TRANS_MIRROR_ROT270
static final int TRANS_MIRROR_ROT270
- See Also:
- Constant Field Values
-
TRANS_MIRROR_ROT90
static final int TRANS_MIRROR_ROT90
- See Also:
- Constant Field Values
-
TRANS_NONE
static final int TRANS_NONE
- See Also:
- Constant Field Values
-
TRANS_ROT180
static final int TRANS_ROT180
- See Also:
- Constant Field Values
-
TRANS_ROT270
static final int TRANS_ROT270
- See Also:
- Constant Field Values
-
TRANS_ROT90
static final int TRANS_ROT90
- See Also:
- Constant Field Values
-
HCENTER
static final int HCENTER
Centering text and images horizontally around the anchor pointValue
1is assigned toHCENTER.- See Also:
- Constant Field Values
-
VCENTER
static final int VCENTER
Centering images vertically around the anchor point.Value
2is assigned toVCENTER.- See Also:
- Constant Field Values
-
LEFT
static final int LEFT
Position the anchor point of text and images to the left of the text or image.Value
4is assigned toLEFT.- See Also:
- Constant Field Values
-
RIGHT
static final int RIGHT
Position the anchor point of text and images to the right of the text or image.Value
8is assigned toRIGHT.- See Also:
- Constant Field Values
-
TOP
static final int TOP
Position the anchor point of text and images above the text or image.Value
16is assigned toTOP.- See Also:
- Constant Field Values
-
BOTTOM
static final int BOTTOM
Position the anchor point of text and images below the text or image.Value
32is assigned toBOTTOM.- See Also:
- Constant Field Values
-
BASELINE
static final int BASELINE
Position the anchor point at the baseline of text.Value
64is assigned toBASELINE.- See Also:
- Constant Field Values
-
SOLID
static final int SOLID
Constant for theSOLIDstroke style.Value
0is assigned toSOLID.- See Also:
- Constant Field Values
-
DOTTED
static final int DOTTED
Constant for theDOTTEDstroke style.Value
1is assigned toDOTTED.- See Also:
- Constant Field Values
-
BLACK
static final int BLACK
- See Also:
- Constant Field Values
-
WHITE
static final int WHITE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setPixel
void setPixel(int x, int y, int color)Method to set a pixel on the screen.- Parameters:
x- the x coordinatey- the y coordinatecolor- the pixel color (0 = white, 1 = black)
-
getPixel
int getPixel(int x, int y)Method to get a pixel from the screen.- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the pixel color (0 = white, 1 = black)
-
drawString
void drawString(java.lang.String str, int x, int y, int anchor, boolean inverted)Draws 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.- 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
void drawString(java.lang.String str, int x, int y, int anchor)Draws the specified String using the current font and color. x and y give the location of the anchor point.- 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
void drawSubstring(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.- 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
void drawChar(char character, int x, int y, int anchor)Draw a single character to the graphics surface using the current color.- 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
void drawChars(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.- 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
int getStrokeStyle()
Return the current stroke style.- Returns:
- current style.
-
setStrokeStyle
void setStrokeStyle(int style)
Set the stroke style to be used for drawing operations.- Parameters:
style- new style.
-
drawRegionRop
void drawRegionRop(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.
Note: This is a non standard method. Added because without it, it is very hard to invert/manipulate an image, or screen region- 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
void drawRegionRop(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.
NOTE: When calculating the anchor point this method assumes that a transformed version of the source width/height should be used.- 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
void drawRegion(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. NOTE: Transforms are not currently supported.- 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 regiontransform-x- destinationy- destinationanchor- location of the anchor point- See Also:
Image
-
drawImage
void drawImage(Image src, int x, int y, int anchor)
Draw the specified image to the graphics surface, using the supplied rop.- 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
void drawLine(int x0, int y0, int x1, int y1)Draw a line between the specified points, using the current color and style.- Parameters:
x0- x start pointy0- y start pointx1- x end pointy1- y end point
-
drawArc
void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)Draw an arc, using the current color and style.- Parameters:
x-y-width-height-startAngle-arcAngle-
-
fillArc
void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)Draw a filled arc, using the current color.- Parameters:
x-y-width-height-startAngle-arcAngle-
-
drawRoundRect
void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)Draw a rounded rectangle.- Parameters:
x-y-width-height-arcWidth-arcHeight-
-
drawRect
void drawRect(int x, int y, int width, int height)Draw a rectangle using the current color and style.- Parameters:
x-y-width-height-
-
fillRect
void fillRect(int x, int y, int w, int h)Draw a filled rectangle using the current color.- Parameters:
x-y-w-h-
-
copyArea
void copyArea(int sx, int sy, int w, int h, int x, int y, int anchor)Copy one rectangular area of the drawing surface to another.- Parameters:
sx- Source xsy- Source yw- Source widthh- Source heightx- Destination xy- Destination yanchor- location of the anchor point of the destination.
-
getFont
Font getFont()
Return the currently selected font object.- Returns:
- Current font.
-
setFont
void setFont(Font f)
Set the current font- Parameters:
f- the font
-
translate
void translate(int x, int y)Translates the origin of the graphics context to the point (x, y) in the current coordinate system. Calls are cumulative.- Parameters:
x- the new translation origin x valuey- new translation origin y value- See Also:
getTranslateX(),getTranslateY()
-
getTranslateX
int getTranslateX()
Gets the X coordinate of the translated origin of this graphics context.- Returns:
- X of current origin
-
getTranslateY
int getTranslateY()
Gets the Y coordinate of the translated origin of this graphics context.- Returns:
- Y of current origin
-
setColor
void setColor(int rgb)
Set 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!- Parameters:
rgb- new color.
-
setColor
void setColor(int red, int green, int blue)Sets the current color to the specified RGB values.- Parameters:
red- the red componentgreen- the green componentblue- the blue- Throws:
java.lang.IllegalArgumentException- if any of the color components are outside of range0-255
-
-