|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graphics
Interface definition for graphics devices. (Offscreen images, displays, ...)
Field Summary | |
---|---|
static int |
AND
Drawmode. |
static int |
INVERSE
Drawmode. |
static int |
NORMAL
Drawmode. |
static int |
OR
Drawmode. |
static int |
XOR
Drawmode. |
Method Summary | |
---|---|
void |
clearRect(int x,
int y,
int width,
int height)
Clears the specified rectangle by filling it with the background color of the current drawing surface. |
int |
drawChar(char c,
int i,
int j)
Draws a single character to the Display. |
void |
drawImage(Object drawable,
int x,
int y)
Draws an image to the specified coordinates. |
void |
drawImage(Object drawable,
int x,
int y,
int width,
int height,
int xoff,
int yoff)
Draws an subimage to the specified coordinates. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line on the graphics device. |
void |
drawRect(int x,
int y,
int width,
int height)
Draws a rectangular frame. |
int |
drawString(String s,
int x,
int y)
Draws a String to the graphics device. |
int |
drawString(String str,
int x,
int y,
int width,
int height,
int xoff,
int yoff)
Draws a String to the graphics device. |
void |
fillRect(int x,
int y,
int width,
int height)
Draws a filled rectangle. |
int |
getDrawMode()
Returns the current Drawmode. |
int |
getFontHeight()
Returns the height of the currently used font in pixels. |
int |
getPixel(int x,
int y)
Returns a single pixels color on the graphics device. |
int |
getTextWidth(String s)
Returns the width of graphical text in pixels, this is dependent from the currently used font. |
void |
setBackground(int color)
Sets the background color (for text etc.). |
void |
setColor(int color)
Sets the foreground color. |
void |
setDrawMode(int mode)
Sets the drawing mode. |
void |
setFont(Object newfont)
Sets the font to use. |
void |
setPixel(int x,
int y)
Sets a single pixel on the graphics device to foreground color. |
Field Detail |
---|
static final int NORMAL
setDrawMode(int)
,
Constant Field Valuesstatic final int AND
setDrawMode(int)
,
Constant Field Valuesstatic final int OR
setDrawMode(int)
,
Constant Field Valuesstatic final int XOR
setDrawMode(int)
,
Constant Field Valuesstatic final int INVERSE
foreground
and
background
color, can be combined with AND
, OR
or XOR
. Useful for deleting a part of a drawing or inverted text.
setDrawMode(int)
,
Constant Field ValuesMethod Detail |
---|
void setColor(int color)
color
- void setBackground(int color)
color
- void setDrawMode(int mode)
mode
- drawmode constant or combination of drawmodes
Possible drawmodes:
#setFGColor(int)
int getDrawMode()
setDrawMode(int)
void setPixel(int x, int y)
x
- the horizontal coordinate.y
- the vertical coordinate.setColor(int)
int getPixel(int x, int y)
x
- the horizontal coordinate.y
- the vertical coordinate.
void drawLine(int x1, int y1, int x2, int y2)
x1
- the horizontal coordinate of starting point.y1
- the vertical coordinate of starting point.x2
- the horizontal coordinate of ending point.y2
- the vertical coordinate of ending point.void drawRect(int x, int y, int width, int height)
x
- the horizontal coordinatey
- the vertical coordinatewidth
- rectangle widthheight
- rectangle heightvoid fillRect(int x, int y, int width, int height)
x
- the horizontal coordinatey
- the vertical coordinatewidth
- rectangle widthheight
- rectangle heightvoid clearRect(int x, int y, int width, int height)
x
- the horizontal coordinatey
- the vertical coordinatewidth
- rectangle widthheight
- rectangle heightvoid drawImage(Object drawable, int x, int y)
Resource
pointing to a JCIF file (use JIFEditor to create)Drawable
specifiying what to draw
drawable
- the image to drawx
- the horizontal coordinatey
- the vertical coordinatevoid drawImage(Object drawable, int x, int y, int width, int height, int xoff, int yoff)
drawable
- the image to drawx
- the horizontal coordinatey
- the vertical coordinatewidth
- the width of the sub image within the source imageheight
- the height of the sub image within the source imagexoff
- horizontal offset of the sub image within the source imageyoff
- vertical offset of the sub image within the source imagedrawImage(Object, int, int)
void setFont(Object newfont)
newfont
- the font to use, possible values: constants defined in the implementing class or
a instance of Resource
specifying the font, the resource has to be
in JCFD format (use FontEdit
of the JControl toolware to generate).drawString(java.lang.String s, int x, int y)
int getFontHeight()
setFont(Object)
,
getTextWidth(String)
int drawString(String s, int x, int y)
String
to the graphics device.
s
- the String
to draw (in some fonts only a few special characters are supported, e.g. german umlauts)x
- the horizontal coordinate of the strings upper left cornery
- the vertical coordinate of the strings upper left corner
setFont(Object)
int drawString(String str, int x, int y, int width, int height, int xoff, int yoff)
String
to the graphics device. The text area may be shifted and cropped to
a specified rectangle.
str
- the String
to draw (in some fonts only a few special characters are supported, e.g. german umlauts)x
- the horizontal coordinate of the strings upper left cornery
- the vertical coordinate of the strings upper left cornerwidth
- the width of the text rectangleheight
- the height of the text rectanglexoff
- horizontal offset of the text within the rectangleyoff
- vertical offset of the text within the rectangle
setFont(Object)
,
drawString(String, int, int)
int getTextWidth(String s)
drawString()
but omits drawing.
s
- the String
which width is to be calculated
drawString(String, int, int)
int drawChar(char c, int i, int j)
c
- the charater to draw (only a few special characters are supported, e.g. german umlauts)x
- the horizontal coordinate of the chars upper left cornery
- the vertical coordinate of the chars upper left corner
setFont(Object)
,
drawString(String, int, int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |