|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.io.AbstractGraphics
public abstract class AbstractGraphics
NOTE: do not use this class!
Contains the low-level graphic routines for Display and Buffers. This class should not not used from outside.
Display
Field Summary | |
---|---|
static int |
NEGATIVE
Displaymode. |
static int |
OFF
Displaymode. |
static int |
ON
Displaymode. |
static String |
SYSTEMFONT
Used to specify the internal font with setFont(Object) . |
Fields inherited from interface jcontrol.io.Graphics |
---|
AND, INVERSE, NORMAL, OR, XOR |
Constructor Summary | |
---|---|
AbstractGraphics()
|
Method Summary | |
---|---|
void |
clearDisplay()
Clears the display. |
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 x,
int y)
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 using Bresenham's Algorithm. |
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 display. |
int |
drawString(String s,
int x,
int y,
int width,
int height,
int xoff,
int yoff)
Draws a String to the Display. |
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 display. |
int |
getTextWidth(String s)
Returns the width of graphical text in pixels, this is dependent from the currently used font. |
void |
scroll(int x,
int y)
Scrolls the whole display content. |
void |
setBackground(int color)
Sets the background color (for text etc.). |
void |
setColor(int color)
Sets the foreground color. |
void |
setDisplayMode(int mode)
Sets the displaymode. |
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 display to foreground color. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Field Detail |
---|
public static final String SYSTEMFONT
setFont(Object)
.
public static final int OFF
setDisplayMode(int)
,
Constant Field Valuespublic static final int ON
setDisplayMode(int)
,
Constant Field Valuespublic static final int NEGATIVE
setDisplayMode(int)
,
Constant Field ValuesConstructor Detail |
---|
public AbstractGraphics()
Method Detail |
---|
public void setColor(int color)
setColor
in interface Graphics
color
- (on BW-displays: 0 for black - default, >0 for white)public void setBackground(int color)
setBackground
in interface Graphics
color
- (on BW-displays: 0 for black, >0 for white - default)public void setDrawMode(int mode)
setDrawMode
in interface Graphics
mode
- drawmode constant or combination of drawmodes
Possible drawmodes:
Graphics.NORMAL
(no change)Graphics.INVERSE
(swaps foreground and background color)Graphics.AND
(logical combination with display pixles, can be combined with INVERSE
)Graphics.OR
(logical combination with display pixles, can be combined with INVERSE
)Graphics.XOR
(logical combination with display pixles, can be combined with INVERSE
)setColor(int)
public int getDrawMode()
getDrawMode
in interface Graphics
setDrawMode(int)
public void drawRect(int x, int y, int width, int height)
drawRect
in interface Graphics
x
- the horizontal coordinatey
- the vertical coordinatewidth
- rectangle widthheight
- rectangle heightpublic void fillRect(int x, int y, int width, int height)
fillRect
in interface Graphics
x
- the horizontal coordinatey
- the vertical coordinatewidth
- rectangle widthheight
- rectangle heightpublic void clearRect(int x, int y, int width, int height)
clearRect
in interface Graphics
x
- the horizontal coordinatey
- the vertical coordinatewidth
- rectangle widthheight
- rectangle heightpublic void drawImage(Object drawable, int x, int y)
Resource
pointing to a JCIF file (use JIFEditor to create)String[]
array in JCIF format (use JIFEditor to create and paste)String
will behave like drawString()
Drawable
specifiying what to drawnull
will behave like fillRect()
drawImage
in interface Graphics
drawable
- the image to drawx
- the horizontal coordinatey
- the vertical coordinatepublic void drawImage(Object drawable, int x, int y, int width, int height, int xoff, int yoff)
drawImage
in interface Graphics
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)
public void setDisplayMode(int mode)
public void clearDisplay()
setBackground(int)
).
public void setPixel(int x, int y)
setPixel
in interface Graphics
x
- the horizontal coordinate.y
- the vertical coordinate.setColor(int)
public int getPixel(int x, int y)
getPixel
in interface Graphics
x
- the horizontal coordinate.y
- the vertical coordinate.
public void drawLine(int x1, int y1, int x2, int y2)
drawLine
in interface Graphics
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.public void setFont(Object newfont)
setFont
in interface Graphics
newfont
- the font to use, possible values: SYSTEMFONT
(default) 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)
,
SYSTEMFONT
public int drawChar(char c, int x, int y)
drawChar
in interface Graphics
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)
public int drawString(String s, int x, int y)
String
to the display.
drawString
in interface Graphics
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)
public int drawString(String s, int x, int y, int width, int height, int xoff, int yoff)
String
to the Display. The text area may be shifted and cropped to
a specified rectangle.
drawString
in interface Graphics
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 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)
public int getTextWidth(String s)
drawString()
but omits drawing.
getTextWidth
in interface Graphics
s
- the String
which width is to be calculated
drawString(String, int, int)
public int getFontHeight()
getFontHeight
in interface Graphics
setFont(Object)
,
getTextWidth(String)
public void scroll(int x, int y)
x
- scroll in horizontal direction (x>0 : to the right)y
- scroll in vertical direction (y>0 : down)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |