|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unifreiburg.twodeedoo.world.AwtCanvas
public class AwtCanvas
Implementation of ICanvas using AWT Graphics.
Constructor Summary | |
---|---|
AwtCanvas(java.awt.Graphics g)
|
Method Summary | |
---|---|
void |
drawFilledCircle(int x,
int y,
int radius,
java.awt.Color color)
Draw a filled circle. |
void |
drawFilledRect(int upperLeftX,
int upperLeftY,
int width,
int height,
java.awt.Color color)
Draw a filled rectangle. |
void |
drawImage(java.awt.Image img,
int x,
int y)
Draws as much of the specified area of the specified image as is currently available. |
void |
drawImage(java.awt.Image img,
int x,
int y,
int sx1,
int sy1,
int sx2,
int sy2)
Draws as much of the specified area of the specified image as is currently available. |
void |
drawLine(int x0,
int y0,
int x1,
int y1,
java.awt.Color color)
Draw a line. |
void |
drawText(int x,
int y,
java.lang.String msg,
java.awt.Color color)
Draw text in the standard font. |
java.awt.Graphics |
getAwtGraphics()
Return the inner Graphics ; you can use it to draw complicated
shapes beyond what this interface offers. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AwtCanvas(java.awt.Graphics g)
Method Detail |
---|
public void drawFilledCircle(int x, int y, int radius, java.awt.Color color)
ICanvas
drawFilledCircle
in interface ICanvas
x
- X of center (in pixels)y
- Y of center (in pixels)radius
- radius in pixelscolor
- color for the circle.public void drawText(int x, int y, java.lang.String msg, java.awt.Color color)
ICanvas
drawText
in interface ICanvas
x
- x coordinate of baseline of first charactery
- y coordinate of baseline of first charactermsg
- a textcolor
- text colorpublic void drawFilledRect(int upperLeftX, int upperLeftY, int width, int height, java.awt.Color color)
ICanvas
drawFilledRect
in interface ICanvas
upperLeftX
- X of upper left cornerupperLeftY
- Y of upper left cornerwidth
- width of rectangleheight
- height of rectanglecolor
- fill colorpublic void drawLine(int x0, int y0, int x1, int y1, java.awt.Color color)
ICanvas
drawLine
in interface ICanvas
x0
- first pointy0
- first pointx1
- second pointy1
- second pointcolor
- colorpublic java.awt.Graphics getAwtGraphics()
ICanvas
Graphics
; you can use it to draw complicated
shapes beyond what this interface offers.
getAwtGraphics
in interface ICanvas
Graphics
public void drawImage(java.awt.Image img, int x, int y)
ICanvas
drawImage
in interface ICanvas
img
- the specified image to be drawn. This method does nothing if
img
is null.x
- the x coordinate.y
- the y coordinate.Image
public void drawImage(java.awt.Image img, int x, int y, int sx1, int sy1, int sx2, int sy2)
ICanvas
drawImage
in interface ICanvas
x
- the x coordinate.y
- the y coordinate.sx1
- the x coordinate of the first corner of the source
rectangle.sy1
- the y coordinate of the first corner of the source
rectangle.sx2
- the x coordinate of the second corner of the source
rectangle.sy2
- the y coordinate of the second corner of the source
rectangle.Image
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |