de.unifreiburg.twodeedoo.world
Class AwtCanvas

java.lang.Object
  extended by de.unifreiburg.twodeedoo.world.AwtCanvas
All Implemented Interfaces:
ICanvas

public class AwtCanvas
extends java.lang.Object
implements ICanvas

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 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AwtCanvas

public AwtCanvas(java.awt.Graphics g)
Method Detail

drawFilledCircle

public void drawFilledCircle(int x,
                             int y,
                             int radius,
                             java.awt.Color color)
Description copied from interface: ICanvas
Draw a filled circle.

Specified by:
drawFilledCircle in interface ICanvas
Parameters:
x - X of center (in pixels)
y - Y of center (in pixels)
radius - radius in pixels
color - color for the circle.

drawText

public void drawText(int x,
                     int y,
                     java.lang.String msg,
                     java.awt.Color color)
Description copied from interface: ICanvas
Draw text in the standard font. The (x,y) point specifies where the baseline of the first character is drawn.

Specified by:
drawText in interface ICanvas
Parameters:
x - x coordinate of baseline of first character
y - y coordinate of baseline of first character
msg - a text
color - text color

drawFilledRect

public void drawFilledRect(int upperLeftX,
                           int upperLeftY,
                           int width,
                           int height,
                           java.awt.Color color)
Description copied from interface: ICanvas
Draw a filled rectangle.

Specified by:
drawFilledRect in interface ICanvas
Parameters:
upperLeftX - X of upper left corner
upperLeftY - Y of upper left corner
width - width of rectangle
height - height of rectangle
color - fill color

drawLine

public void drawLine(int x0,
                     int y0,
                     int x1,
                     int y1,
                     java.awt.Color color)
Description copied from interface: ICanvas
Draw a line.

Specified by:
drawLine in interface ICanvas
Parameters:
x0 - first point
y0 - first point
x1 - second point
y1 - second point
color - color

getAwtGraphics

public java.awt.Graphics getAwtGraphics()
Description copied from interface: ICanvas
Return the inner Graphics; you can use it to draw complicated shapes beyond what this interface offers.

Specified by:
getAwtGraphics in interface ICanvas
Returns:
the inner Graphics