Interface GraphicsLCD

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      Font getFont()
      Return the currently selected font object.
      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.
      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 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.
    • Field Detail

      • HCENTER

        static final int HCENTER
        Centering text and images horizontally around the anchor point

        Value 1 is assigned to HCENTER.

        See Also:
        Constant Field Values
      • VCENTER

        static final int VCENTER
        Centering images vertically around the anchor point.

        Value 2 is assigned to VCENTER.

        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 4 is assigned to LEFT.

        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 8 is assigned to RIGHT.

        See Also:
        Constant Field Values
      • TOP

        static final int TOP
        Position the anchor point of text and images above the text or image.

        Value 16 is assigned to TOP.

        See Also:
        Constant Field Values
      • BOTTOM

        static final int BOTTOM
        Position the anchor point of text and images below the text or image.

        Value 32 is assigned to BOTTOM.

        See Also:
        Constant Field Values
      • BASELINE

        static final int BASELINE
        Position the anchor point at the baseline of text.

        Value 64 is assigned to BASELINE.

        See Also:
        Constant Field Values
      • SOLID

        static final int SOLID
        Constant for the SOLID stroke style.

        Value 0 is assigned to SOLID.

        See Also:
        Constant Field Values
      • DOTTED

        static final int DOTTED
        Constant for the DOTTED stroke style.

        Value 1 is assigned to DOTTED.

        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 coordinate
        y - the y coordinate
        color - 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 coordinate
        y - 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 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

        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 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

        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 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

        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 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

        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 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

        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 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

        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 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

        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 region
        sy - y offset to the region
        w - width of the region
        h - height of the region
        transform -
        x - destination
        y - destination
        anchor - 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 - destination
        y - destination
        anchor - 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 point
        y0 - y start point
        x1 - x end point
        y1 - 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 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

        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 value
        y - 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 component
        green - the green component
        blue - the blue
        Throws:
        java.lang.IllegalArgumentException - if any of the color components are outside of range 0-255