de.unifreiburg.twodeedoo.view
Class ImagePart

java.lang.Object
  extended by de.unifreiburg.twodeedoo.view.ImagePart
All Implemented Interfaces:
IBrush

public class ImagePart
extends java.lang.Object
implements IBrush

A rectangular part of a BufferedImage. Can draw itself on a Graphics.


Constructor Summary
ImagePart(java.awt.image.BufferedImage image)
          Take the whole image.
ImagePart(java.awt.image.BufferedImage image, int ulCornerX, int ulCornerY, int width, int height)
          Create from image and some coordinates inside it.
 
Method Summary
 void paint(java.awt.Graphics g, int x, int y)
          Paint.
 java.lang.String toString()
          nice string representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImagePart

public ImagePart(java.awt.image.BufferedImage image,
                 int ulCornerX,
                 int ulCornerY,
                 int width,
                 int height)
Create from image and some coordinates inside it.

Parameters:
image - a BufferedImage as obtained from e.g. ImageIO.read(java.io.File)
ulCornerX - pixel coordinates of upper left corner of intersting part in image
ulCornerY -
width - width in pixel of interesting part
height - height in pixel of interesting part.

ImagePart

public ImagePart(java.awt.image.BufferedImage image)
Take the whole image.

Parameters:
image - some image all of which will be painted.
Method Detail

paint

public void paint(java.awt.Graphics g,
                  int x,
                  int y)
Paint.

Specified by:
paint in interface IBrush
Parameters:
g - the Graphics
x - x coordinate (screen units)
y - y coordinate (screen units)

toString

public java.lang.String toString()
nice string representation

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()