brf.j2me.dynaworks.env
Interface Graphics

All Known Implementing Classes:
J9Graphics, KJavaGraphics

public interface Graphics

The Graphics interface grants access to the graphics screen of the device.

Version:
1.0
Author:
Bernd R. Fix

Field Summary
static int AND
          constant for bitblt AND mode.
static int AND_NOT
          constant for bitblt AND_NOT mode.
static int BUFFER
          constant for camvas (buffer).
static int ERASE
          constant for erasing drawing mode.
static int GRAY
          constant for grayed drawing mode.
static int INVERT
          constant for inverted drawing mode.
static int NOT
          constant for bitblt NOT mode.
static int OR
          constant for bitblt OR mode.
static int OVERWRITE
          constant for bitblt OVERWRITE mode.
static int PLAIN
          constant for plain drawing mode.
static int RAISED
          constant for raised border.
static int SCREEN
          constant for canvas (screen).
static int SIMPLE
          constant for simple border.
static int XOR
          constant for bitblt XOR mode.
 
Method Summary
 void bitBlt(int sx, int sy, int w, int h, int tx, int ty, int mode)
          bitblt areas on the screen.
 void bitBlt(int sx, int sy, int w, int h, int tx, int ty, int mode, int from, int to)
          bitblt areas between canvases.
 void clearScreen()
          clear screen.
 void dispose()
          dispose object.
 void drawBitmap(int x, int y, Bitmap icon)
          draw a bitmap.
 void drawBorder(int x, int y, int w, int h, int mode, int thick, int round)
          draw a border (outlined area with rounded corners).
 void drawLine(int x, int y, int xx, int yy, int mode)
          draw a line between two points.
 void drawRectangle(int x, int y, int w, int h, int mode, int round)
          draw a rectangle (solid area with rounded corners).
 int drawString(java.lang.String text, int x, int y)
          draw a text in plain mode.
 int drawString(java.lang.String text, int x, int y, int mode)
          draw a text in a specified mode.
 int getHeight()
          get screen height.
 int getStringHeight(java.lang.String s)
          Get the display height of a string in pixels.
 int getStringWidth(java.lang.String s)
          Get the display width of a string in pixels.
 int getWidth()
          get screen width.
 void resetDrawRegion()
          reset a clipping region for drawing.
 void setDrawRegion(int x, int y, int w, int h)
          set a clipping region for drawing.
 

Field Detail

SIMPLE

public static final int SIMPLE
constant for simple border.


RAISED

public static final int RAISED
constant for raised border.


PLAIN

public static final int PLAIN
constant for plain drawing mode.


GRAY

public static final int GRAY
constant for grayed drawing mode.


ERASE

public static final int ERASE
constant for erasing drawing mode.


INVERT

public static final int INVERT
constant for inverted drawing mode.


OVERWRITE

public static final int OVERWRITE
constant for bitblt OVERWRITE mode.


AND

public static final int AND
constant for bitblt AND mode.


AND_NOT

public static final int AND_NOT
constant for bitblt AND_NOT mode.


XOR

public static final int XOR
constant for bitblt XOR mode.


OR

public static final int OR
constant for bitblt OR mode.


NOT

public static final int NOT
constant for bitblt NOT mode.


SCREEN

public static final int SCREEN
constant for canvas (screen).


BUFFER

public static final int BUFFER
constant for camvas (buffer).

Method Detail

getWidth

public int getWidth()
get screen width.

Returns:
int - width of screen (160 pixel for PalmOS devices)

getHeight

public int getHeight()
get screen height.

Returns:
int - height of screen (160 pixel for PalmOS devices)

clearScreen

public void clearScreen()
clear screen.


setDrawRegion

public void setDrawRegion(int x,
                          int y,
                          int w,
                          int h)
set a clipping region for drawing.

Parameters:
x - int - x-ccordinate of upper left corner.
y - int - y-coordinate of upper left corner.
w - int - width in pixel (positive to right)
h - int - height in pixel (positive to bottom)

resetDrawRegion

public void resetDrawRegion()
reset a clipping region for drawing.


drawBorder

public void drawBorder(int x,
                       int y,
                       int w,
                       int h,
                       int mode,
                       int thick,
                       int round)
draw a border (outlined area with rounded corners).

Parameters:
x - int - x-ccordinate of upper left corner.
y - int - y-coordinate of upper left corner.
w - int - width in pixel (positive to right)
h - int - height in pixel (positive to bottom)
mode - int - drawing mode.
thick - int - thickness of border.
round - int - diameter of rounded corners.

drawRectangle

public void drawRectangle(int x,
                          int y,
                          int w,
                          int h,
                          int mode,
                          int round)
draw a rectangle (solid area with rounded corners).

Parameters:
x - int - x-ccordinate of upper left corner.
y - int - y-coordinate of upper left corner.
w - int - width in pixel (positive to right)
h - int - height in pixel (positive to bottom)
mode - int - drawing mode.
round - int - diameter of rounded corners.

drawBitmap

public void drawBitmap(int x,
                       int y,
                       Bitmap icon)
draw a bitmap.

Parameters:
x - int - x-ccordinate of upper left corner.
y - int - y-coordinate of upper left corner.
icon - Bitmap - bitmap to be displayed.

drawLine

public void drawLine(int x,
                     int y,
                     int xx,
                     int yy,
                     int mode)
draw a line between two points.

Parameters:
x - int - x-ccordinate of first endpoint.
y - int - y-coordinate of first endpoint.
xx - int - x-ccordinate of second endpoint.
yy - int - y-coordinate of second endpoint.
mode - int - drawing mode.

getStringWidth

public int getStringWidth(java.lang.String s)
Get the display width of a string in pixels.

Parameters:
s - String - string content to be checked.
Returns:
int - display width for string.

getStringHeight

public int getStringHeight(java.lang.String s)
Get the display height of a string in pixels.

Parameters:
s - String - string content to be checked.
Returns:
int - display height for string.

drawString

public int drawString(java.lang.String text,
                      int x,
                      int y,
                      int mode)
draw a text in a specified mode.

Parameters:
s - String - string to be displayed.
x - int - x-ccordinate of upper left corner.
y - int - y-coordinate of upper left corner.
mode - int - drawing mode.
Returns:
int - the next x-ccordinate after the string.

drawString

public int drawString(java.lang.String text,
                      int x,
                      int y)
draw a text in plain mode.

Parameters:
s - String - string to be displayed.
x - int - x-ccordinate of upper left corner.
y - int - y-coordinate of upper left corner.
Returns:
int - the next x-ccordinate after the string.

bitBlt

public void bitBlt(int sx,
                   int sy,
                   int w,
                   int h,
                   int tx,
                   int ty,
                   int mode,
                   int from,
                   int to)
bitblt areas between canvases.

Parameters:
sx - int - x-ccordinate of upper left corner of source area.
sy - int - y-coordinate of upper left corner of source area.
w - int - width in pixel (positive to right) of source area
h - int - height in pixel (positive to bottom) of source area
tx - int - x-ccordinate of upper left corner of target area.
ty - int - y-coordinate of upper left corner of target area.
mode - int - bitblt mode.
from - int - ID of source canvas
to - int - ID of target canvas

bitBlt

public void bitBlt(int sx,
                   int sy,
                   int w,
                   int h,
                   int tx,
                   int ty,
                   int mode)
bitblt areas on the screen.

Parameters:
sx - int - x-ccordinate of upper left corner of source area.
sy - int - y-coordinate of upper left corner of source area.
w - int - width in pixel (positive to right) of source area
h - int - height in pixel (positive to bottom) of source area
tx - int - x-ccordinate of upper left corner of target area.
ty - int - y-coordinate of upper left corner of target area.
mode - int - bitblt mode.

dispose

public void dispose()
dispose object.