moka.io
Class Graph

java.lang.Object
  |
  +--moka.lang.Object
        |
        +--moka.io.Graph

public final class Graph
extends Object

The Graph class provides methods to deal with bitmaps and display. This class has many features of the Graphics class, but implements them more efficiently. However, these methods, instead of those of Graphics class, will not manage grayscale automatically.

Since:
MDK2.2

Field Summary
static short A_AND
          AND the region to draw (alias).
static short A_NORMAL
          Draw with destination pixels turned on (alias).
static short A_OR
          Draw with source pixels ORed with destination pixels (alias).
static short A_REPLACE
          Draw with source pixels replace destination pixels (alias).
static short A_REVERSE
          Draw with destination pixels turned off (alias).
static short A_SHADE_H
          Draw the line using a horizontal shading pattern (alias).
static short A_SHADE_NS
          Draw the line using a negative slope diagonal shading pattern (alias).
static short A_SHADE_PS
          Draw the line using a positive slope diagonal shading pattern (alias).
static short A_SHADE_V
          Draw the line using a vertical shading pattern (alias).
static short A_SHADED
          Draw with destination pixels masked so that every other pixel turned off (alias)
static short A_THICK1
          Draw a double thick line (alias).
static short A_XOR
          Draw with source pixels XORed with destination pixels (alias).
static short AND_ATTR
          AND the region to draw.
static short NORMAL_ATTR
          Draw with destination pixels turned on.
static short OR_ATTR
          Draw with source pixels ORed with destination pixels.
static short REPLACE_ATTR
          Draw with source pixels replace destination pixels.
static short REVERSE_ATTR
          Draw with destination pixels turned off.
static short SHADE_H_ATTR
          Draw the line using a horizontal shading pattern.
static short SHADE_NS_ATTR
          Draw the line using a negative slope diagonal shading pattern.
static short SHADE_PS_ATTR
          Draw the line using a positive slope diagonal shading pattern.
static short SHADE_V_ATTR
          Draw the line using a vertical shading pattern.
static short SHADED_ATTR
          Draw with destination pixels masked so that every other pixel turned off
static short THICK1_ATTR
          Draw a double thick line.
static short XOR_ATTR
          Draw with source pixels XORed with destination pixels.
 
Method Summary
static void clrscr()
          Clears the current display device screen.
static void clrScr()
          Clears the current display device screen.
static void draw(short x, short y, char[] str, short attr)
          Draws an ANSI string on the current display device screen.
static void draw(short x, short y, char c, short attr)
          Draws a char on the current display device screen.
static void draw(short x, short y, double num, short attr)
          Draws a double on the current display device screen.
static void draw(short x, short y, int num, short attr)
          Draws an int on the current display device screen.
static void draw(short x, short y, long num, short attr)
          Draws a long on the current display device screen.
static void draw(short x, short y, short num, short attr)
          Draws a short on the current display device screen.
static void draw(short x, short y, java.lang.String str, short attr)
          Draws a String object on the current display device screen then finalizes the String object.
static void drawChar(short x, short y, char c, short attr)
          Draws a char on the current display device screen.
static void drawEllipse(short x, short y, short a, short b, short attr)
          Draws a elipse on the current display device screen.
static void drawLine(short x0, short y0, short x1, short y1, short attr)
          Draws a line on the current display device screen.
static void drawPix(short x, short y, short attr)
          Draws a pixel on the current display device screen.
static void drawTo(short x, short y)
          Draws a line from the current pen position (set by moveTo) on the current display device screen.
static boolean getPix(short x, short y)
          Gets the status of a pixel on the current display device screen.
static void moveTo(short x, short y)
          Move the current pen position.
static void picVarPut(char[] SymName, short x, short y, short attr)
          Puts a TIOS PIC variable on the screen.
static void picVarPut(java.lang.String file, short x, short y, short attr)
          Puts a TIOS PIC variable on the screen.
static void putBitmap(moka.io.BITMAP_p b, short x, short y, short attr)
          Puts a BITMAP on the screen.
 
Methods inherited from class moka.lang.Object
equals, finalize, getClassName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVERSE_ATTR

public static final short REVERSE_ATTR
Draw with destination pixels turned off.

See Also:
Constant Field Values

NORMAL_ATTR

public static final short NORMAL_ATTR
Draw with destination pixels turned on.

See Also:
Constant Field Values

XOR_ATTR

public static final short XOR_ATTR
Draw with source pixels XORed with destination pixels.

See Also:
Constant Field Values

SHADED_ATTR

public static final short SHADED_ATTR
Draw with destination pixels masked so that every other pixel turned off

See Also:
Constant Field Values

REPLACE_ATTR

public static final short REPLACE_ATTR
Draw with source pixels replace destination pixels.

See Also:
Constant Field Values

OR_ATTR

public static final short OR_ATTR
Draw with source pixels ORed with destination pixels.

See Also:
Constant Field Values

AND_ATTR

public static final short AND_ATTR
AND the region to draw.

See Also:
Constant Field Values

THICK1_ATTR

public static final short THICK1_ATTR
Draw a double thick line.

See Also:
Constant Field Values

SHADE_V_ATTR

public static final short SHADE_V_ATTR
Draw the line using a vertical shading pattern.

See Also:
Constant Field Values

SHADE_H_ATTR

public static final short SHADE_H_ATTR
Draw the line using a horizontal shading pattern.

See Also:
Constant Field Values

SHADE_NS_ATTR

public static final short SHADE_NS_ATTR
Draw the line using a negative slope diagonal shading pattern.

See Also:
Constant Field Values

SHADE_PS_ATTR

public static final short SHADE_PS_ATTR
Draw the line using a positive slope diagonal shading pattern.

See Also:
Constant Field Values

A_REVERSE

public static final short A_REVERSE
Draw with destination pixels turned off (alias).

See Also:
Constant Field Values

A_NORMAL

public static final short A_NORMAL
Draw with destination pixels turned on (alias).

See Also:
Constant Field Values

A_XOR

public static final short A_XOR
Draw with source pixels XORed with destination pixels (alias).

See Also:
Constant Field Values

A_SHADED

public static final short A_SHADED
Draw with destination pixels masked so that every other pixel turned off (alias)

See Also:
Constant Field Values

A_REPLACE

public static final short A_REPLACE
Draw with source pixels replace destination pixels (alias).

See Also:
Constant Field Values

A_OR

public static final short A_OR
Draw with source pixels ORed with destination pixels (alias).

See Also:
Constant Field Values

A_AND

public static final short A_AND
AND the region to draw (alias).

See Also:
Constant Field Values

A_THICK1

public static final short A_THICK1
Draw a double thick line (alias).

See Also:
Constant Field Values

A_SHADE_V

public static final short A_SHADE_V
Draw the line using a vertical shading pattern (alias).

See Also:
Constant Field Values

A_SHADE_H

public static final short A_SHADE_H
Draw the line using a horizontal shading pattern (alias).

See Also:
Constant Field Values

A_SHADE_NS

public static final short A_SHADE_NS
Draw the line using a negative slope diagonal shading pattern (alias).

See Also:
Constant Field Values

A_SHADE_PS

public static final short A_SHADE_PS
Draw the line using a positive slope diagonal shading pattern (alias).

See Also:
Constant Field Values
Method Detail

clrscr

public static void clrscr()
Clears the current display device screen.


clrScr

public static void clrScr()
Clears the current display device screen. The pen position will remain intact.


drawChar

public static void drawChar(short x,
                            short y,
                            char c,
                            short attr)
Draws a char on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
c - The char to draw
attr - The attribute

drawPix

public static void drawPix(short x,
                           short y,
                           short attr)
Draws a pixel on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.XOR_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
attr - The attribute

drawLine

public static void drawLine(short x0,
                            short y0,
                            short x1,
                            short y1,
                            short attr)
Draws a line on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.XOR_ATTR, Graph.THICK1_ATTR, Graph.SHADE_V_ATTR, Graph.SHADE_H_ATTR, Graph.SLOPE_NS_ATTR, Graph.SLOPE_PS_ATTR.

Parameters:
x0 - The x coordinate of the upper left corner
y0 - The y coordinate of the upper left corner
x1 - The x coordinate of the lower right corner
y1 - The y coordinate of the lower right corner
attr - The attribute

drawEllipse

public static void drawEllipse(short x,
                               short y,
                               short a,
                               short b,
                               short attr)
Draws a elipse on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.XOR_ATTR.

Parameters:
x - The x coordinate of the elipse
y - The y coordinate of the elipse
a - The horizontal semiaxe of the elipse
b - The vertical semiaxe of the elipse
attr - The attribute

drawTo

public static void drawTo(short x,
                          short y)
Draws a line from the current pen position (set by moveTo) on the current display device screen.

Parameters:
x - The x coordinate
y - The y coordinate

moveTo

public static void moveTo(short x,
                          short y)
Move the current pen position.

Parameters:
x - The x coordinate
y - The y coordinate

draw

public static void draw(short x,
                        short y,
                        char[] str,
                        short attr)
Draws an ANSI string on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
str - The ANSI string to draw
attr - The attribute

draw

public static void draw(short x,
                        short y,
                        java.lang.String str,
                        short attr)
Draws a String object on the current display device screen then finalizes the String object. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
str - The String to draw
attr - The attribute

draw

public static void draw(short x,
                        short y,
                        short num,
                        short attr)
Draws a short on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
num - The short to draw
attr - The attribute

draw

public static void draw(short x,
                        short y,
                        int num,
                        short attr)
Draws an int on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
num - The int to draw
attr - The attribute

draw

public static void draw(short x,
                        short y,
                        long num,
                        short attr)
Draws a long on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
num - The long to draw
attr - The attribute

draw

public static void draw(short x,
                        short y,
                        double num,
                        short attr)
Draws a double on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
num - The double to draw
attr - The attribute

draw

public static void draw(short x,
                        short y,
                        char c,
                        short attr)
Draws a char on the current display device screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR.

Parameters:
x - The x coordinate
y - The y coordinate
c - The char to draw
attr - The attribute

getPix

public static boolean getPix(short x,
                             short y)
Gets the status of a pixel on the current display device screen.

Parameters:
x - The x coordinate
y - The y coordinate
Returns:
true if the pixel is on, false otherwize

putBitmap

public static void putBitmap(moka.io.BITMAP_p b,
                             short x,
                             short y,
                             short attr)
Puts a BITMAP on the screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR, Graph.OR_ATTR, Graph.AND_ATTR.

Parameters:
b - The BITMAP
x - Absolute horizontal coordinate
y - Absolute vertical coordinate
attr - Display attribute

picVarPut

public static void picVarPut(char[] SymName,
                             short x,
                             short y,
                             short attr)
Puts a TIOS PIC variable on the screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR, Graph.OR_ATTR, Graph.AND_ATTR.

Parameters:
SymName - TIOS variable name, in vat string format
x - Absolute horizontal coordinate
y - Absolute vertical coordinate
attr - Display attribute

picVarPut

public static void picVarPut(java.lang.String file,
                             short x,
                             short y,
                             short attr)
Puts a TIOS PIC variable on the screen. The following attributes are supported: Graph.NORMAL_ATTR, Graph.REVERSE_ATTR, Graph.REPLACE_ATTR, Graph.XOR_ATTR, Graph.SHADED_ATTR, Graph.OR_ATTR, Graph.AND_ATTR. If the file string object risk to be used later, use a copy of the string object instead of the original, the string being finalized before the method returns.

Parameters:
file - The PIC file name
x - Absolute horizontal coordinate
y - Absolute vertical coordinate
attr - Display attribute