fdda.graphics.java2d
Class Painter

java.lang.Object
  |
  +--fdda.graphics.java2d.Painter

public class Painter
extends Object

Paints the graphical systems. There are two different general ways to do this: paint in the normal graphics thread of Java; or paint on a buffered image that is then drawn on the screen in this graphics thread. Currently, the first method is used. However, to ensure fast switching and changeability, there are two drawing methods: one that has a graphics object as a parameter, and one that doesn't. This last one does _nothing_ currently. Still, whenever you want to redraw some part of the system, determine its shape and call - in this order - repaintSystem() and updateScreen(). At least, that's the _normal_ way of doing it ;-) All important methods are synchronized; this prevents e.g. the clipping shape from being changed while the painting is still in progress.

Author:
Jörg Rüdenauer

Constructor Summary
Painter(GraphicHolder graphicHolder)
          Constructor.
 
Method Summary
 void addClippingShape(Shape shape)
          Adds another shape to the clipping shape.
protected  void clearBackground()
          Clears the background of the system.
protected  void clearBackground(Graphics2D graphics)
          Clears the background of the system, using a specified graphics object
protected  void drawGraphicalSystem()
          Draws the graphical system.
protected  void drawGraphicalSystem(Graphics2D graphics)
          Draws the graphical system, using a specified graphics object
 Shape getClippingShape()
          Return the current clipping shape
 void repaintSystem()
          Repaints the graphical system, using the current clipping shape.
 void repaintSystem(Graphics2D graphics)
          Repaints the graphical system, using the current clipping shape and the given graphics object.
 void setBGColor(Color color)
          Sets the background color
 void setClippingShape(Shape shape)
          Defines the clipping shape.
 void updateScreen()
          Initiates a repainting of the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Painter

public Painter(GraphicHolder graphicHolder)
Constructor.

Parameters:
graphicHolder - the object holding the graphic
Method Detail

setClippingShape

public void setClippingShape(Shape shape)
Defines the clipping shape.

Parameters:
shape - the clipping shape

addClippingShape

public void addClippingShape(Shape shape)
Adds another shape to the clipping shape.

Parameters:
shape - the additional clipping shape

getClippingShape

public Shape getClippingShape()
Return the current clipping shape

Returns:
the clipping shape

repaintSystem

public void repaintSystem()
Repaints the graphical system, using the current clipping shape.


repaintSystem

public void repaintSystem(Graphics2D graphics)
Repaints the graphical system, using the current clipping shape and the given graphics object.

Parameters:
graphics - the graphics

setBGColor

public void setBGColor(Color color)
Sets the background color

Parameters:
color - the color

updateScreen

public void updateScreen()
Initiates a repainting of the screen.


clearBackground

protected void clearBackground()
Clears the background of the system. Does nothing in the current implementation.


clearBackground

protected void clearBackground(Graphics2D graphics)
Clears the background of the system, using a specified graphics object

Parameters:
graphics - the graphics

drawGraphicalSystem

protected void drawGraphicalSystem()
Draws the graphical system. Does nothing in the current implementation.


drawGraphicalSystem

protected void drawGraphicalSystem(Graphics2D graphics)
Draws the graphical system, using a specified graphics object

Parameters:
graphics - the graphics


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.