de.unifreiburg.twodeedoo.world
Interface ICanvas

All Known Implementing Classes:
AwtCanvas

public interface ICanvas

Simple drawing surface, wraps an AWT Graphics.

Author:
anton

Method Summary
 void drawFilledCircle(int centerX, int centerY, 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.
 

Method Detail

drawFilledCircle

void drawFilledCircle(int centerX,
                      int centerY,
                      int radius,
                      java.awt.Color color)
Draw a filled circle.

Parameters:
centerX - X of center (in pixels)
centerY - Y of center (in pixels)
radius - radius in pixels
color - color for the circle.

drawText

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

Parameters:
x - x coordinate of baseline of first character
y - y coordinate of baseline of first character
msg - a text
color - text color

drawFilledRect

void drawFilledRect(int upperLeftX,
                    int upperLeftY,
                    int width,
                    int height,
                    java.awt.Color color)
Draw a filled rectangle.

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

void drawLine(int x0,
              int y0,
              int x1,
              int y1,
              java.awt.Color color)
Draw a line.

Parameters:
x0 - first point
y0 - first point
x1 - second point
y1 - second point
color - color

drawImage

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. Transparent pixels do not affect whatever pixels are already there.

Parameters:
img - the specified image to be drawn. This method does nothing if img is null.
x - the x coordinate.
y - the y coordinate.
See Also:
Image

drawImage

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. Transparent pixels do not affect whatever pixels are already there.

Parameters:
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.
See Also:
Image

getAwtGraphics

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

Returns:
the inner Graphics