org.apache.batik.refimpl.gvt.renderer
Class StaticRenderer

java.lang.Object
  |
  +--org.apache.batik.refimpl.gvt.renderer.StaticRenderer
All Implemented Interfaces:
Renderer
Direct Known Subclasses:
DynamicRenderer

public class StaticRenderer
extends java.lang.Object
implements Renderer

Simple implementation of the Renderer that simply does static rendering in an offscreen buffer image.


Field Summary
protected  GraphicsNodeRenderContext nodeRenderContext
          Passed to the GVT tree to describe the rendering environment
protected  java.awt.image.BufferedImage offScreen
          Offscreen image where the Renderer does its rendering
protected  GraphicsNode treeRoot
          Tree this Renderer paints.
protected  java.awt.geom.AffineTransform usr2dev
          The transform to go to device space.
 
Constructor Summary
StaticRenderer(java.awt.image.BufferedImage offScreen)
           
StaticRenderer(java.awt.image.BufferedImage offScreen, GraphicsNodeRenderContext rc)
           
 
Method Summary
 void dispose()
          Disposes all resources of this renderer.
 GraphicsNodeRenderContext getRenderContext()
           
 java.awt.geom.AffineTransform getTransform()
          Returns a copy of the transform from the current user space (as defined by the top node of the GVT tree) to the device space (1 unit = 1/72nd of an inch / 1 pixel, roughly speaking
 GraphicsNode getTree()
          Returns the GVT tree associated with this renderer
 boolean isProgressivePaintAllowed()
          Returns true if the Renderer is currently allowed to do progressive painting.
 void repaint(java.awt.Shape area)
          Forces repaint of provided node.
 void setOffScreen(java.awt.image.BufferedImage offScreen)
           
 void setProgressivePaintAllowed(boolean progressivePaintAllowed)
          Turns on/off progressive painting.
 void setRenderContext(GraphicsNodeRenderContext rc)
           
 void setTransform(java.awt.geom.AffineTransform usr2dev)
          Sets the transform from the current user space (as defined by the top node of the GVT tree, to the associated device space.
 void setTree(GraphicsNode treeRoot)
          This associates the given GVT Tree with this renderer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

treeRoot

protected GraphicsNode treeRoot
Tree this Renderer paints.

offScreen

protected java.awt.image.BufferedImage offScreen
Offscreen image where the Renderer does its rendering

nodeRenderContext

protected GraphicsNodeRenderContext nodeRenderContext
Passed to the GVT tree to describe the rendering environment

usr2dev

protected java.awt.geom.AffineTransform usr2dev
The transform to go to device space.
Constructor Detail

StaticRenderer

public StaticRenderer(java.awt.image.BufferedImage offScreen,
                      GraphicsNodeRenderContext rc)
Parameters:
offScreen - image where the Renderer should do its rendering
rc - a GraphicsNodeRenderContext which this renderer should use

StaticRenderer

public StaticRenderer(java.awt.image.BufferedImage offScreen)
Parameters:
offScreen - image where the Renderer should do its rendering
Method Detail

setRenderContext

public void setRenderContext(GraphicsNodeRenderContext rc)
Parameters:
rc - a GraphicsNodeRenderContext which the Renderer should use for its rendering

getRenderContext

public GraphicsNodeRenderContext getRenderContext()
Returns:
the GraphicsNodeRenderContext which the Renderer uses for its rendering

setOffScreen

public void setOffScreen(java.awt.image.BufferedImage offScreen)
Parameters:
offScreen - image where the Renderer should do its rendering

dispose

public void dispose()
Disposes all resources of this renderer.
Specified by:
dispose in interface Renderer

setTree

public void setTree(GraphicsNode treeRoot)
This associates the given GVT Tree with this renderer. Any previous tree association is forgotten. Not certain if this should be just GraphicsNode, or CanvasGraphicsNode.
Specified by:
setTree in interface Renderer

getTree

public GraphicsNode getTree()
Description copied from interface: Renderer
Returns the GVT tree associated with this renderer
Specified by:
getTree in interface Renderer
Returns:
the GVT tree associated with this renderer

repaint

public void repaint(java.awt.Shape area)
             throws java.lang.InterruptedException
Forces repaint of provided node. 'node' must be a node in the currently associated GVT tree. Normally there is no need to call this method explicitly as the Renderer listens for changes on all nodes in the tree it is associated with.
Specified by:
repaint in interface Renderer
Parameters:
area - region to be repainted, in the current user space coordinate system.

setTransform

public void setTransform(java.awt.geom.AffineTransform usr2dev)
Sets the transform from the current user space (as defined by the top node of the GVT tree, to the associated device space.
Specified by:
setTransform in interface Renderer
Parameters:
usr2dev - the new user space to device space transform. If null, the identity transform will be set.

getTransform

public java.awt.geom.AffineTransform getTransform()
Returns a copy of the transform from the current user space (as defined by the top node of the GVT tree) to the device space (1 unit = 1/72nd of an inch / 1 pixel, roughly speaking
Specified by:
getTransform in interface Renderer

isProgressivePaintAllowed

public boolean isProgressivePaintAllowed()
Returns true if the Renderer is currently allowed to do progressive painting.
Specified by:
isProgressivePaintAllowed in interface Renderer

setProgressivePaintAllowed

public void setProgressivePaintAllowed(boolean progressivePaintAllowed)
Turns on/off progressive painting. Turning off progressive painting will cause a repaint if any progressive painting has been made.
Specified by:
setProgressivePaintAllowed in interface Renderer


Copyright © 2000 Apache Software Foundation. All Rights Reserved.