ballwar.model
Interface IPaintStrategy

All Known Implementing Classes:
ADecoratorPaintStrategy, AnimatePaintStrategy, APaintStrategy, BallPaintStrategy, BirdSheepImagePaintStrategy, EllipsePaintStrategy, Fish1PaintStrategy, Fish2PaintStrategy, FixedColorDecoratorPaintStrategy, ImagePaintStrategy, MultiPaintStrategy, NiceFishPaintStrategy, RectanglePaintStrategy, ShapePaintStrategy, SquarePaintStrategy, SwimFishPaintStrategy

public interface IPaintStrategy

Interface that represents a strategy used by a Ball when asked to perform variant paint operations.


Field Summary
static IPaintStrategy NullObject
          The singleton null object instance for this interface, which does nothing.
 
Method Summary
 void init(Ball host)
          Initializes the given ball.
 void paint(Graphics g, Ball host)
          Paints the host onto the given Graphics context.
 void paintXfrm(Graphics g, Ball host, AffineTransform at)
          Paints the host onto the given Graphics context.
 

Field Detail

NullObject

static final IPaintStrategy NullObject
The singleton null object instance for this interface, which does nothing.

Method Detail

paint

void paint(Graphics g,
           Ball host)
Paints the host onto the given Graphics context. The image is translated, scaled and rotated as determined by the host's locaton, radius, and velocity

Parameters:
g - The graphics context to draw upon.
host - The host ball.

paintXfrm

void paintXfrm(Graphics g,
               Ball host,
               AffineTransform at)
Paints the host onto the given Graphics context. The image is translated, scaled and rotated as determined by the given affine transformation. This allows the same transformation to be shared amongst multiple paint strategies.

Parameters:
g - The graphics context to draw upon.
host - The host ball.
at - The affine transform to use.

init

void init(Ball host)
Initializes the given ball. Called once by the ball when the strategy is first loaded.

Parameters:
context - The ball to initialize.