|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectballwar.model.paint.APaintStrategy
ballwar.model.paint.ImagePaintStrategy
public class ImagePaintStrategy
Paint strategy that paints an image from a file, scaled to the host Ball's radius. Note that this class cannot be used by the BallWar system directly as it is missing a no-parameter constructor.
| Field Summary | |
|---|---|
private Image |
image
The image to paint |
private ImageObserver |
imageObs
ImageObserver needed for some image operations |
private double |
scaleFactor
Number of times larger than unit size of image |
| Fields inherited from class ballwar.model.paint.APaintStrategy |
|---|
at |
| Fields inherited from interface ballwar.model.IPaintStrategy |
|---|
NullObject |
| Constructor Summary | |
|---|---|
ImagePaintStrategy(AffineTransform at,
String filename,
double fillFactor)
Constructor that takes an external AffineTransform, the filename of the image to paint and a fill factor of the image. |
|
ImagePaintStrategy(String filename,
double fillFactor)
Constructor that takes the image filename and fill factor. |
|
| Method Summary | |
|---|---|
void |
init(Ball host)
Initializes the internal ImageObserver reference from the host Ball |
protected void |
paintCfg(Graphics g,
Ball host)
Augments the inhereited paint method to add the scaling of the image by the scaleFactor and translation to the center of the image. |
void |
paintXfrm(Graphics g,
Ball host,
AffineTransform at)
Draws the image on the given Graphics context using the given affine transform. |
| Methods inherited from class ballwar.model.paint.APaintStrategy |
|---|
paint |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private ImageObserver imageObs
private Image image
private double scaleFactor
| Constructor Detail |
|---|
public ImagePaintStrategy(String filename,
double fillFactor)
filename - The filename of the image file to use.fillFactor - The ratio of the desired average radius of the image to the actual average of the image's width and height.
public ImagePaintStrategy(AffineTransform at,
String filename,
double fillFactor)
at - The AffineTransform to use internally.filename - The filename of the image file to use.fillFactor - The ratio of the desired average radius of the image to the actual average of the image's width and height.| Method Detail |
|---|
protected void paintCfg(Graphics g,
Ball host)
paintCfg in class APaintStrategyg - The Graphics context that will be drawn upon.host - The Ball to be painted.
public void paintXfrm(Graphics g,
Ball host,
AffineTransform at)
g - The graphics context to paint onhost - The host Ballat - The AffineTransform to use.public void init(Ball host)
init in interface IPaintStrategyinit in class APaintStrategyhost - The host Ball
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||