Class RemoteGraphicsLCD

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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.
      void clear()
      Clear the display.
      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.
      void drawArc​(int x, int y, int width, int height, int startAngle, int arcAngle)
      Draw an arc, using the current color and style.
      void drawChar​(char character, int x, int y, int anchor)
      Draw a single character to the graphics surface using the current color.
      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.
      void drawImage​(Image src, int x, int y, int anchor)
      Draw the specified image to the graphics surface, using the supplied rop.
      void drawLine​(int x0, int y0, int x1, int y1)
      Draw a line between the specified points, using the current color and style.
      void drawRect​(int x, int y, int width, int height)
      Draw a rectangle using the current color and style.
      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.
      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.
      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.
      void drawRoundRect​(int x, int y, int width, int height, int arcWidth, int arcHeight)
      Draw a rounded rectangle.
      void drawString​(java.lang.String str, int x, int y, int anchor)
      Draws the specified String using the current font and color.
      void drawString​(java.lang.String str, int x, int y, int anchor, boolean inverted)
      Draws the specified String using the current font and color.
      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.
      void fillArc​(int x, int y, int width, int height, int startAngle, int arcAngle)
      Draw a filled arc, using the current color.
      void fillRect​(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.
      Font getFont()
      Return the currently selected font object.
      int getHeight()
      Return the height of the associated drawing surface.
      byte[] getHWDisplay()
      Get access to hardware LCD display.
      int getPixel​(int x, int y)
      Method to get a pixel from the screen.
      int getStrokeStyle()
      Return the current stroke style.
      int getTranslateX()
      Gets the X coordinate of the translated origin of this graphics context.
      int getTranslateY()
      Gets the Y coordinate of the translated origin of this graphics context.
      int getWidth()
      Return the width of the associated drawing surface.
      void refresh()
      Refresh the display.
      void setAutoRefresh​(boolean on)
      Turn on/off the automatic refresh of the LCD display.
      int setAutoRefreshPeriod​(int period)
      Set the period used to perform automatic refreshing of the display.
      void setColor​(int rgb)
      Set the current drawing color.
      void setColor​(int red, int green, int blue)
      Sets the current color to the specified RGB values.
      void setContrast​(int contrast)
      Set the LCD contrast.
      void setFont​(Font f)
      Set the current font
      void setPixel​(int x, int y, int color)
      Method to set a pixel on the screen.
      void setStrokeStyle​(int style)
      Set the stroke style to be used for drawing operations.
      void translate​(int x, int y)
      Translates the origin of the graphics context to the point (x, y) in the current coordinate system.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • refresh

        public void refresh()
        Description copied from interface: CommonLCD
        Refresh 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.
        Specified by:
        refresh in interface CommonLCD
      • clear

        public void clear()
        Description copied from interface: CommonLCD
        Clear the display.
        Specified by:
        clear in interface CommonLCD
      • getWidth

        public int getWidth()
        Description copied from interface: CommonLCD
        Return the width of the associated drawing surface.
        Note: This is a non standard method.
        Specified by:
        getWidth in interface CommonLCD
        Returns:
        width of the surface
      • getHeight

        public int getHeight()
        Description copied from interface: CommonLCD
        Return the height of the associated drawing surface.
        Note: This is a non standard method.
        Specified by:
        getHeight in interface CommonLCD
        Returns:
        height of the surface.
      • getDisplay

        public byte[] getDisplay()
        Description copied from interface: CommonLCD
        Provide access to the LCD display frame buffer.
        Specified by:
        getDisplay in interface CommonLCD
        Returns:
        byte array that is the frame buffer.
      • getHWDisplay

        public byte[] getHWDisplay()
        Description copied from interface: CommonLCD
        Get access to hardware LCD display.
        Specified by:
        getHWDisplay in interface CommonLCD
        Returns:
        byte array that is the frame buffer
      • setContrast

        public void setContrast​(int contrast)
        Description copied from interface: CommonLCD
        Set the LCD contrast.
        Specified by:
        setContrast in interface CommonLCD
        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: CommonLCD
        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.
        Specified by:
        bitBlt in interface CommonLCD
        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 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: CommonLCD
        Standard two input BitBlt function. Supports standard raster ops and overlapping images. Images are held in native leJOS/Lego format.
        Specified by:
        bitBlt in interface CommonLCD
        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.
      • setAutoRefresh

        public void setAutoRefresh​(boolean on)
        Description copied from interface: CommonLCD
        Turn on/off the automatic refresh of the LCD display. At system startup auto refresh is on.
        Specified by:
        setAutoRefresh in interface CommonLCD
        Parameters:
        on - true to enable, false to disable
      • setAutoRefreshPeriod

        public int setAutoRefreshPeriod​(int period)
        Description copied from interface: CommonLCD
        Set the period used to perform automatic refreshing of the display. A period of 0 disables the refresh.
        Specified by:
        setAutoRefreshPeriod in interface CommonLCD
        Parameters:
        period - time in ms
        Returns:
        the previous refresh period.
      • setPixel

        public void setPixel​(int x,
                             int y,
                             int color)
        Description copied from interface: GraphicsLCD
        Method to set a pixel on the screen.
        Specified by:
        setPixel in interface GraphicsLCD
        Parameters:
        x - the x coordinate
        y - the y coordinate
        color - the pixel color (0 = white, 1 = black)
      • getPixel

        public int getPixel​(int x,
                            int y)
        Description copied from interface: GraphicsLCD
        Method to get a pixel from the screen.
        Specified by:
        getPixel in interface GraphicsLCD
        Parameters:
        x - the x coordinate
        y - 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: GraphicsLCD
        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.
        Specified by:
        drawString in interface GraphicsLCD
        Parameters:
        str - the String to be drawn
        x - the x coordinate of the anchor point
        y - the y coordinate of the anchor point
        anchor - the anchor point for positioning the text
        inverted - true to invert the text display.
      • drawString

        public void drawString​(java.lang.String str,
                               int x,
                               int y,
                               int anchor)
        Description copied from interface: GraphicsLCD
        Draws the specified String using the current font and color. x and y give the location of the anchor point.
        Specified by:
        drawString in interface GraphicsLCD
        Parameters:
        str - the String to be drawn
        x - the x coordinate of the anchor point
        y - the y coordinate of the anchor point
        anchor - 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: GraphicsLCD
        Draw a substring to the graphics surface using the current color.
        Specified by:
        drawSubstring in interface GraphicsLCD
        Parameters:
        str - the base string
        offset - the start of the sub string
        len - the length of the sub string
        x - the x coordinate of the anchor point
        y - the x coordinate of the anchor point
        anchor - the anchor point used to position the text.
      • drawChar

        public void drawChar​(char character,
                             int x,
                             int y,
                             int anchor)
        Description copied from interface: GraphicsLCD
        Draw a single character to the graphics surface using the current color.
        Specified by:
        drawChar in interface GraphicsLCD
        Parameters:
        character - the character to draw
        x - the x coordinate of the anchor point
        y - the x coordinate of the anchor point
        anchor - 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: GraphicsLCD
        Draw a series of characters to the graphics surface using the current color.
        Specified by:
        drawChars in interface GraphicsLCD
        Parameters:
        data - the characters
        offset - the start of the characters to be drawn
        length - the length of the character string to draw
        x - the x coordinate of the anchor point
        y - the x coordinate of the anchor point
        anchor - the anchor point used to position the text.
      • getStrokeStyle

        public int getStrokeStyle()
        Description copied from interface: GraphicsLCD
        Return the current stroke style.
        Specified by:
        getStrokeStyle in interface GraphicsLCD
        Returns:
        current style.
      • setStrokeStyle

        public void setStrokeStyle​(int style)
        Description copied from interface: GraphicsLCD
        Set the stroke style to be used for drawing operations.
        Specified by:
        setStrokeStyle in interface GraphicsLCD
        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: GraphicsLCD
        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
        Specified by:
        drawRegionRop in interface GraphicsLCD
        Parameters:
        src - image to draw (may be null for ops that do not require input.
        sx - x offset in the source
        sy - y offset in the source
        w - width of area to draw
        h - height of area to draw.
        x - destination
        y - destination
        anchor - location of the anchor point
        rop - 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: GraphicsLCD
        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.
        Specified by:
        drawRegionRop in interface GraphicsLCD
        Parameters:
        src - The source image
        sx - x coordinate of the region
        sy - y coordinate of the region
        w - width of the region
        h - height of the region
        transform - the required transform
        x - x coordinate of the anchor point
        y - y coordinate of the anchor point
        anchor - type of anchor
        rop - 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: GraphicsLCD
        Draw the specified region of the supplied image to the graphics surface. NOTE: Transforms are not currently supported.
        Specified by:
        drawRegion in interface GraphicsLCD
        Parameters:
        src - image to draw (may be null for ops that do not require input.
        sx - x offset to the region
        sy - y offset to the region
        w - width of the region
        h - height of the region
        x - destination
        y - destination
        anchor - location of the anchor point
        See Also:
        Image
      • drawImage

        public void drawImage​(Image src,
                              int x,
                              int y,
                              int anchor)
        Description copied from interface: GraphicsLCD
        Draw the specified image to the graphics surface, using the supplied rop.
        Specified by:
        drawImage in interface GraphicsLCD
        Parameters:
        src - image to draw (may be null for ops that do not require input.
        x - destination
        y - destination
        anchor - location of the anchor point
        See Also:
        Image
      • drawLine

        public void drawLine​(int x0,
                             int y0,
                             int x1,
                             int y1)
        Description copied from interface: GraphicsLCD
        Draw a line between the specified points, using the current color and style.
        Specified by:
        drawLine in interface GraphicsLCD
        Parameters:
        x0 - x start point
        y0 - y start point
        x1 - x end point
        y1 - y end point
      • drawArc

        public void drawArc​(int x,
                            int y,
                            int width,
                            int height,
                            int startAngle,
                            int arcAngle)
        Description copied from interface: GraphicsLCD
        Draw an arc, using the current color and style.
        Specified by:
        drawArc in interface GraphicsLCD
      • fillArc

        public void fillArc​(int x,
                            int y,
                            int width,
                            int height,
                            int startAngle,
                            int arcAngle)
        Description copied from interface: GraphicsLCD
        Draw a filled arc, using the current color.
        Specified by:
        fillArc in interface GraphicsLCD
      • drawRoundRect

        public void drawRoundRect​(int x,
                                  int y,
                                  int width,
                                  int height,
                                  int arcWidth,
                                  int arcHeight)
        Description copied from interface: GraphicsLCD
        Draw a rounded rectangle.
        Specified by:
        drawRoundRect in interface GraphicsLCD
      • drawRect

        public void drawRect​(int x,
                             int y,
                             int width,
                             int height)
        Description copied from interface: GraphicsLCD
        Draw a rectangle using the current color and style.
        Specified by:
        drawRect in interface GraphicsLCD
      • fillRect

        public void fillRect​(int x,
                             int y,
                             int w,
                             int h)
        Description copied from interface: GraphicsLCD
        Draw a filled rectangle using the current color.
        Specified by:
        fillRect in interface GraphicsLCD
      • copyArea

        public void copyArea​(int sx,
                             int sy,
                             int w,
                             int h,
                             int x,
                             int y,
                             int anchor)
        Description copied from interface: GraphicsLCD
        Copy one rectangular area of the drawing surface to another.
        Specified by:
        copyArea in interface GraphicsLCD
        Parameters:
        sx - Source x
        sy - Source y
        w - Source width
        h - Source height
        x - Destination x
        y - Destination y
        anchor - location of the anchor point of the destination.
      • getFont

        public Font getFont()
        Description copied from interface: GraphicsLCD
        Return the currently selected font object.
        Specified by:
        getFont in interface GraphicsLCD
        Returns:
        Current font.
      • setFont

        public void setFont​(Font f)
        Description copied from interface: GraphicsLCD
        Set the current font
        Specified by:
        setFont in interface GraphicsLCD
        Parameters:
        f - the font
      • translate

        public void translate​(int x,
                              int y)
        Description copied from interface: GraphicsLCD
        Translates the origin of the graphics context to the point (x, y) in the current coordinate system. Calls are cumulative.
        Specified by:
        translate in interface GraphicsLCD
        Parameters:
        x - the new translation origin x value
        y - new translation origin y value
        See Also:
        GraphicsLCD.getTranslateX(), GraphicsLCD.getTranslateY()
      • getTranslateX

        public int getTranslateX()
        Description copied from interface: GraphicsLCD
        Gets the X coordinate of the translated origin of this graphics context.
        Specified by:
        getTranslateX in interface GraphicsLCD
        Returns:
        X of current origin
      • getTranslateY

        public int getTranslateY()
        Description copied from interface: GraphicsLCD
        Gets the Y coordinate of the translated origin of this graphics context.
        Specified by:
        getTranslateY in interface GraphicsLCD
        Returns:
        Y of current origin
      • setColor

        public void setColor​(int rgb)
        Description copied from interface: GraphicsLCD
        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!
        Specified by:
        setColor in interface GraphicsLCD
        Parameters:
        rgb - new color.
      • setColor

        public void setColor​(int red,
                             int green,
                             int blue)
        Description copied from interface: GraphicsLCD
        Sets the current color to the specified RGB values.
        Specified by:
        setColor in interface GraphicsLCD
        Parameters:
        red - the red component
        green - the green component
        blue - the blue