public class TurtleRenderer
extends java.lang.Object
implements java.awt.image.ImageObserver
| Constructor and Description |
|---|
TurtleRenderer(Turtle turtle)
Creates a TurtleRenderer instance for the given turtle.
|
| Modifier and Type | Method and Description |
|---|---|
java.awt.Image |
currentImage()
Returns the current image.
|
boolean |
imageChanged(double angle)
Tells whether the image has changed.
|
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
As an image stays unchanged, there's no need to ever update it.
|
void |
init(TurtleFactory factory,
int resolution)
Creates the images.
|
void |
paint(double x,
double y)
This method is responsible for painting the turtle onto the
playground at (
x, y). |
void |
paint(double x,
double y,
java.awt.Graphics g)
This method is responsible for painting the
Turtle
at (x, y). |
void |
paint(java.awt.geom.Point2D.Double p)
This method is responsible for painting the turtle onto the
playground at
p. |
void |
paint(java.awt.geom.Point2D.Double p,
java.awt.Graphics g)
This method is responsible for painting the
Turtle
at p. |
void |
setAngle(double angle)
Sets the current image to the one corresponding to the angle
angle. |
public TurtleRenderer(Turtle turtle)
public boolean imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
java.awt.image.ImageObserver.imageUpdate in interface java.awt.image.ImageObserverImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)public java.awt.Image currentImage()
public boolean imageChanged(double angle)
public void setAngle(double angle)
angle.public void init(TurtleFactory factory, int resolution)
resolution images (i.e. two subsequent
images contain an angle of 2π/public final void paint(double x,
double y)
x, y).public final void paint(java.awt.geom.Point2D.Double p)
p.public final void paint(double x,
double y,
java.awt.Graphics g)
Turtle
at (x, y).public void paint(java.awt.geom.Point2D.Double p,
java.awt.Graphics g)
Turtle
at p.