public class BallPaintStrategy extends java.lang.Object implements IPaintStrategy
Modifier and Type | Field and Description |
---|---|
private java.awt.geom.AffineTransform |
at
The AffineTransformed used for internal calculations.
|
private java.awt.geom.Ellipse2D.Double |
ball
Unit sized circle used as a prototype
|
NullObject
Constructor and Description |
---|
BallPaintStrategy()
No parameter constructor that creates a 1 pixel radius ball
at the origin.
|
BallPaintStrategy(java.awt.geom.AffineTransform at,
double x,
double y,
double width,
double height)
Constructor that allows one to create the prototype ball of arbitrary
dimension and location.
|
Modifier and Type | Method and Description |
---|---|
void |
init(Ball context)
By default, do nothing for initialization.
|
void |
paint(java.awt.Graphics g,
Ball host)
Paints on the given graphics context using the color, scale and
direction provided by the host.
|
void |
paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at)
Paints a transformed circle, as per the given AffineTransform
Uses color already set in Graphics context
|
private java.awt.geom.Ellipse2D.Double ball
private java.awt.geom.AffineTransform at
public BallPaintStrategy()
public BallPaintStrategy(java.awt.geom.AffineTransform at, double x, double y, double width, double height)
at
- The AffineTransform to use for internal calculationsx
- floating point x-coordinate of center of circley
- floating point y-coordinate of center of circlewidth
- floating point x-radius of the circle (ellipse)height
- floating point y-radius of the circle (ellipse)public void paint(java.awt.Graphics g, Ball host)
paint
in interface IPaintStrategy
g
- The graphics context to draw upon.host
- The host ball.public void paintXfrm(java.awt.Graphics g, Ball host, java.awt.geom.AffineTransform at)
g
- The Graphics context to paint onhost
- The Ball hostat
- the AffineTransform to usepublic void init(Ball context)
init
in interface IPaintStrategy
context
- The ball to initialize.