lejos.nxt
Class LCD

java.lang.Object
  extended by lejos.nxt.LCD

public class LCD
extends Object

Text and graphics output to the LCD display.

Author:
Andre Nijholt and BB bitBlt and other mods Andy Shaw

Field Summary
static int CELL_HEIGHT
           
static int CELL_WIDTH
           
static int DISPLAY_CHAR_DEPTH
           
static int DISPLAY_CHAR_WIDTH
           
static int DISPLAY_DEPTH
           
static int DISPLAY_WIDTH
           
static int FONT_HEIGHT
           
static int FONT_WIDTH
           
static int NOOF_CHARS
           
static int ROP_AND
           
static int ROP_ANDINVERTED
           
static int ROP_ANDREVERSE
           
static int ROP_CLEAR
          Common raster operations for use with bitBlt
static int ROP_COPY
           
static int ROP_COPYINVERTED
           
static int ROP_EQUIV
           
static int ROP_INVERT
           
static int ROP_NAND
           
static int ROP_NOOP
           
static int ROP_NOR
           
static int ROP_OR
           
static int ROP_ORINVERTED
           
static int ROP_ORREVERSE
           
static int ROP_SET
           
static int ROP_XOR
           
static int SCREEN_HEIGHT
           
static int SCREEN_WIDTH
           
 
Constructor Summary
LCD()
           
 
Method Summary
static 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)
          Standard two input BitBlt function.
static void bitBlt(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.
static void bitBlt(int dx, int dy, int w, int h, int rop)
          Special case bitBlt with no input image.
static void clear()
          Clear the display.
static void clearDisplay()
           
static void drawChar(char c, int x, int y, boolean invert)
          Draw a single char to an arbitary location on the screen.
static void drawChar(char c, int x, int y, int rop)
          Draw a single char to an arbitary location on the screen.
static void drawInt(int i, int x, int y)
          Display an int on the LCD at specified x,y co-ordinate.
static void drawInt(int i, int places, int x, int y)
          Display an in on the LCD at x,y with leading spaces to occupy at least the number of characters specified by the places parameter.
static void drawPixels(byte b, int x, int y, boolean invert)
          Draw pixels a byte at a time.
static void drawString(String str, int x, int y)
          Display a string on the LCD at specified x,y co-ordinate.
static void drawString(String str, int x, int y, boolean invert)
          Output a string to the display.
static void drawString(String str, int x, int y, int rop)
          Output a string to the display.
static byte[] getDisplay()
          Provide access to the LCD display frame buffer.
static int getPixel(int x, int y)
          Method to get a pixel from the screen.
static byte[] getSystemFont()
          Provide access to the LCD system font.
static void refresh()
          Update the display.
static void scroll()
          Scrolls the screen up one text line
static void setAutoRefresh(int mode)
          Turn on/off the automatic refresh of the LCD display.
static void setDisplay()
           
static void setDisplay(int[] buff)
          Write graphics from a Java buffer to the display.
static void setPixel(int rgbColor, int x, int y)
          Method to set a pixel to screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCREEN_WIDTH

public static final int SCREEN_WIDTH
See Also:
Constant Field Values

SCREEN_HEIGHT

public static final int SCREEN_HEIGHT
See Also:
Constant Field Values

DISPLAY_WIDTH

public static final int DISPLAY_WIDTH
See Also:
Constant Field Values

DISPLAY_DEPTH

public static final int DISPLAY_DEPTH
See Also:
Constant Field Values

NOOF_CHARS

public static final int NOOF_CHARS
See Also:
Constant Field Values

FONT_WIDTH

public static final int FONT_WIDTH
See Also:
Constant Field Values

FONT_HEIGHT

public static final int FONT_HEIGHT
See Also:
Constant Field Values

CELL_WIDTH

public static final int CELL_WIDTH
See Also:
Constant Field Values

CELL_HEIGHT

public static final int CELL_HEIGHT
See Also:
Constant Field Values

DISPLAY_CHAR_WIDTH

public static final int DISPLAY_CHAR_WIDTH
See Also:
Constant Field Values

DISPLAY_CHAR_DEPTH

public static final int DISPLAY_CHAR_DEPTH
See Also:
Constant Field Values

ROP_CLEAR

public static final int ROP_CLEAR
Common raster operations for use with bitBlt

See Also:
Constant Field Values

ROP_AND

public static final int ROP_AND
See Also:
Constant Field Values

ROP_ANDREVERSE

public static final int ROP_ANDREVERSE
See Also:
Constant Field Values

ROP_COPY

public static final int ROP_COPY
See Also:
Constant Field Values

ROP_ANDINVERTED

public static final int ROP_ANDINVERTED
See Also:
Constant Field Values

ROP_NOOP

public static final int ROP_NOOP
See Also:
Constant Field Values

ROP_XOR

public static final int ROP_XOR
See Also:
Constant Field Values

ROP_OR

public static final int ROP_OR
See Also:
Constant Field Values

ROP_NOR

public static final int ROP_NOR
See Also:
Constant Field Values

ROP_EQUIV

public static final int ROP_EQUIV
See Also:
Constant Field Values

ROP_INVERT

public static final int ROP_INVERT
See Also:
Constant Field Values

ROP_ORREVERSE

public static final int ROP_ORREVERSE
See Also:
Constant Field Values

ROP_COPYINVERTED

public static final int ROP_COPYINVERTED
See Also:
Constant Field Values

ROP_ORINVERTED

public static final int ROP_ORINVERTED
See Also:
Constant Field Values

ROP_NAND

public static final int ROP_NAND
See Also:
Constant Field Values

ROP_SET

public static final int ROP_SET
See Also:
Constant Field Values
Constructor Detail

LCD

public LCD()
Method Detail

bitBlt

public static void bitBlt(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. Supports standard raster ops and overlapping images. Images are held in native leJOS/Lego format.

Parameters:
src - byte array containing the source image
sw - Width of the source image
sh - Height of the source image
sx - X position to start the copy from
sy - Y Position to start the copy from
dx - X destination
dy - Y destination
w - width of the area to copy
h - height of the area to copy
rop - raster operation.

bitBlt

public static void bitBlt(int dx,
                          int dy,
                          int w,
                          int h,
                          int rop)
Special case bitBlt with no input image. Can be used to clear areas draw rectangles etc.

Parameters:
dx - X destination
dy - Y destination
w - width of the area to copy
h - height of the area to copy
rop - raster operation.

setPixel

public static void setPixel(int rgbColor,
                            int x,
                            int y)
Method to set a pixel to screen.

Parameters:
rgbColor - the pixel color (0 = white, 1 = black)
x - the x coordinate
y - the y coordinate

getPixel

public static int getPixel(int x,
                           int y)
Method to get a pixel from the screen.

Parameters:
x - the x coordinate
y - the y coordinate
Returns:
the pixel color (0 = white, 1 = black)

drawString

public static void drawString(String str,
                              int x,
                              int y,
                              boolean invert)
Output a string to the display. Allow any location. Allow the string to be inverted.

Parameters:
str - String to display
x - X location (pixels)
y - Y location (pixels)
invert - set to true to displayed the string inverted

drawChar

public static void drawChar(char c,
                            int x,
                            int y,
                            boolean invert)
Draw a single char to an arbitary location on the screen.

Parameters:
c - Character to display
x - X location (pixels)
y - Y location (pixels)
invert - Set to true to invert the display

drawString

public static void drawString(String str,
                              int x,
                              int y,
                              int rop)
Output a string to the display. Allow any location. Allow use of raster operations.

Parameters:
str - String to display
x - X location (pixels)
y - Y location (pixels)
rop - Raster operation

drawChar

public static void drawChar(char c,
                            int x,
                            int y,
                            int rop)
Draw a single char to an arbitary location on the screen.

Parameters:
c - Character to display
x - X location (pixels)
y - Y location (pixels)
rop - Raster operation for how to combine with existing content

drawPixels

public static void drawPixels(byte b,
                              int x,
                              int y,
                              boolean invert)
Draw pixels a byte at a time. Should probably no longer be used.

Parameters:
b -
x -
y -
invert -

clearDisplay

public static void clearDisplay()

setDisplay

public static void setDisplay()

drawString

public static void drawString(String str,
                              int x,
                              int y)
Display a string on the LCD at specified x,y co-ordinate.


drawInt

public static void drawInt(int i,
                           int x,
                           int y)
Display an int on the LCD at specified x,y co-ordinate.


drawInt

public static void drawInt(int i,
                           int places,
                           int x,
                           int y)
Display an in on the LCD at x,y with leading spaces to occupy at least the number of characters specified by the places parameter.


refresh

public static void refresh()
Update the display.


clear

public static void clear()
Clear the display.


setDisplay

public static void setDisplay(int[] buff)
Write graphics from a Java buffer to the display.


getDisplay

public static byte[] getDisplay()
Provide access to the LCD display frame buffer. Allows both the firmware and Java to make changes.

Returns:
byte array that is the frame buffer.

getSystemFont

public static byte[] getSystemFont()
Provide access to the LCD system font. Allows both the firmware and Java to share the same font bitmaps.

Returns:
byte array that is the frame buffer.

setAutoRefresh

public static void setAutoRefresh(int mode)
Turn on/off the automatic refresh of the LCD display. At system startup auto refresh is on.

Parameters:
mode - 1 to enable 0 to disable

bitBlt

public static 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)
Standard two input BitBlt function. Supports standard raster ops and overlapping images. Images are held in native leJOS/Lego format.

Parameters:
src - byte array containing the source image
sw - Width of the source image
sh - Height of the source image
sx - X position to start the copy from
sy - Y Position to start the copy from
dst - byte array containing the destination image
dw - Width of the destination image
dh - Height of the destination image
dx - X destination
dy - Y destination
w - width of the area to copy
h - height of the area to copy
rop - raster operation.

scroll

public static void scroll()
Scrolls the screen up one text line