brf.j2me.dynaworks.env.kjava
Class KJavaGraphics

java.lang.Object
  |
  +--brf.j2me.dynaworks.env.kjava.KJavaGraphics
All Implemented Interfaces:
Graphics

public class KJavaGraphics
extends java.lang.Object
implements Graphics

The KJavaGraphics class implements the Graphics interface for Palms.

Version:
1.0
Author:
Bernd R. Fix
See Also:
Graphics

Field Summary
private  int[] modes
           
 
Fields inherited from interface brf.j2me.dynaworks.env.Graphics
AND, AND_NOT, BUFFER, ERASE, GRAY, INVERT, NOT, OR, OVERWRITE, PLAIN, RAISED, SCREEN, SIMPLE, XOR
 
Constructor Summary
KJavaGraphics()
           
 
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()
          drop the graphics 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 width, 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 height of canvas.
 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 width of canvas.
private  com.sun.kjava.Bitmap prepare(Bitmap bm)
           
 void resetDrawRegion()
          reset a clipping region for drawing.
 void setDrawRegion(int x, int y, int w, int h)
          set a clipping region for drawing.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

modes

private final int[] modes
Constructor Detail

KJavaGraphics

public KJavaGraphics()
Method Detail

getWidth

public int getWidth()
get width of canvas.

Specified by:
getWidth in interface Graphics
Returns:
int - width of the canvas (160 pixel for PalmOS).

getHeight

public int getHeight()
get height of canvas.

Specified by:
getHeight in interface Graphics
Returns:
int - height of the canvas (160 pixel for PalmOS).

clearScreen

public void clearScreen()
Description copied from interface: Graphics
clear screen.

Specified by:
clearScreen in interface Graphics

setDrawRegion

public void setDrawRegion(int x,
                          int y,
                          int w,
                          int h)
Description copied from interface: Graphics
set a clipping region for drawing.

Specified by:
setDrawRegion in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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()
Description copied from interface: Graphics
reset a clipping region for drawing.

Specified by:
resetDrawRegion in interface Graphics

getStringWidth

public int getStringWidth(java.lang.String s)
Description copied from interface: Graphics
Get the display width of a string in pixels.

Specified by:
getStringWidth in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
Parameters:
s - String - string content to be checked.
Returns:
int - display width for string.

getStringHeight

public int getStringHeight(java.lang.String s)
Description copied from interface: Graphics
Get the display height of a string in pixels.

Specified by:
getStringHeight in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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)
Description copied from interface: Graphics
draw a text in a specified mode.

Specified by:
drawString in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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)
Description copied from interface: Graphics
draw a text in plain mode.

Specified by:
drawString in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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.

drawBorder

public void drawBorder(int x,
                       int y,
                       int w,
                       int h,
                       int mode,
                       int width,
                       int round)
Description copied from interface: Graphics
draw a border (outlined area with rounded corners).

Specified by:
drawBorder in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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)
Description copied from interface: Graphics
draw a rectangle (solid area with rounded corners).

Specified by:
drawRectangle in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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)
Description copied from interface: Graphics
draw a bitmap.

Specified by:
drawBitmap in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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)
Description copied from interface: Graphics
draw a line between two points.

Specified by:
drawLine in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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.

bitBlt

public void bitBlt(int sx,
                   int sy,
                   int w,
                   int h,
                   int tx,
                   int ty,
                   int mode)
Description copied from interface: Graphics
bitblt areas on the screen.

Specified by:
bitBlt in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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.

bitBlt

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

Specified by:
bitBlt in interface Graphics
Following copied from interface: brf.j2me.dynaworks.env.Graphics
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

dispose

public void dispose()
drop the graphics object.

Specified by:
dispose in interface Graphics

prepare

private com.sun.kjava.Bitmap prepare(Bitmap bm)