ballwar.model.paint
Class APaintStrategy

java.lang.Object
  extended by ballwar.model.paint.APaintStrategy
All Implemented Interfaces:
IPaintStrategy
Direct Known Subclasses:
AnimatePaintStrategy, ImagePaintStrategy, MultiPaintStrategy, ShapePaintStrategy

public abstract class APaintStrategy
extends Object
implements IPaintStrategy

An abstract paint strategy that provides default behavior for its subclasses.


Field Summary
protected  AffineTransform at
          The affine transform used by this paint strategy to translate, scale and rotate the image.
 
Fields inherited from interface ballwar.model.IPaintStrategy
NullObject
 
Constructor Summary
APaintStrategy(AffineTransform at)
          Constructor that initializes the strategy with an affine transform
 
Method Summary
 void init(Ball context)
          By default, do nothing for initialization.
 void paint(Graphics g, Ball host)
          Paints on the given graphics context using the color, scale and direction provided by the host.
protected  void paintCfg(Graphics g, Ball host)
          Used for doing additional configurations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ballwar.model.IPaintStrategy
paintXfrm
 

Field Detail

at

protected AffineTransform at
The affine transform used by this paint strategy to translate, scale and rotate the image.

Constructor Detail

APaintStrategy

public APaintStrategy(AffineTransform at)
Constructor that initializes the strategy with an affine transform

Parameters:
at - The AffineTransform for this paint strategy to use.
Method Detail

paint

public void paint(Graphics g,
                  Ball host)
Paints on the given graphics context using the color, scale and direction provided by the host. This is done by setting up the AffineTransform to rotate then scale then translate. Calls paintXfrm to actually perform the painting, using the set up transform. Calls paintCfg just before calling paintXfrm param g The Graphics context that will be paint on param host The host Ball that the required information will be pulled from.

Specified by:
paint in interface IPaintStrategy
Parameters:
g - The graphics context to draw upon.
host - The host ball.

init

public void init(Ball context)
By default, do nothing for initialization.

Specified by:
init in interface IPaintStrategy

paintCfg

protected void paintCfg(Graphics g,
                        Ball host)
Used for doing additional configurations. All additional transformations applied to the existing internal affine transform will be performed before those set up by the paint method. This method is designed to be overridden by the subclass. By default the behavior is a no-op.

Parameters:
g - The Graphics context that will be drawn upon.
host - The Ball to be painted.