edu.umd.cs.jazz.scenegraph
Class ZRenderContext

java.lang.Object
  |
  +--edu.umd.cs.jazz.scenegraph.ZRenderContext

public class ZRenderContext
extends java.lang.Object

ZRenderContext stores information relevant to the current render as it occurs. The ZRenderContext lives with the scenegraph because this way the scenegraph can be queried about how it is currently being rendered (if at all). The ZRenderContext stores information about what cameras are being rendered (there could be more than one if a portal is being recursively rendered).

See Also:
ZCamera

Field Summary
protected  boolean accurateSpacing
          accurateSpacing causes strings to be rendered one character at a time: slower, but characters are positioned more accurately in a line.
protected  float cameraMagnification
           
protected  java.util.Stack cameraMagStack
           
protected  java.util.Stack cameras
          List of (recursive) cameras currently rendering the scenegraph
protected  java.awt.Graphics2D g2
           
protected  boolean greekText
          greekText specifies that text should be rendered as "greek" rather than actual characters
protected  ZSurface surface
           
protected  java.util.Stack transforms
          List of (recursive) transforms that are the transform that the camera started with before it started painting.
protected  ZArea visibleArea
           
 
Constructor Summary
ZRenderContext(java.awt.Graphics2D aG2, ZArea aVisibleArea, ZSurface aSurface, int qualityRequested)
          Constructs a new ZRenderContext.
 
Method Summary
 boolean getAccurateSpacing()
          Determine if strings should be rendered with accurate (but slower) character spacing.
 float getCameraMagnification()
          Returns the magnification of the current camera being rendered within.
 float getCompositeMagnification()
          Returns the total current magnification that is currently being used for rendering.
 java.awt.Graphics2D getGraphics2D()
           
 boolean getGreekText()
          Determine if text should be rendered "greeked"
 ZCamera getRenderingCamera()
           
 java.awt.geom.AffineTransform getRenderingTransform()
           
 ZSurface getSurface()
           
 ZArea getVisibleArea()
           
 void popCamera()
           
 void pushCamera(ZCamera camera)
           
 void setAccurateSpacing(boolean b)
          Specify if strings should be rendered one character at a time with slower, but more accurate spacing.
 void setGreekText(boolean b)
          Specify if strings should be rendered as "greek" blobs rather than actual text.
protected  void setRenderingHints(java.awt.Graphics2D g2, int quality)
          Sets the rendering hints of the specified graphics to either or high or low.
 void setVisibleArea(ZArea area)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cameras

protected java.util.Stack cameras
List of (recursive) cameras currently rendering the scenegraph

transforms

protected java.util.Stack transforms
List of (recursive) transforms that are the transform that the camera started with before it started painting. Visual components could need to know this for advanced techniques.

surface

protected ZSurface surface

g2

protected java.awt.Graphics2D g2

visibleArea

protected ZArea visibleArea

cameraMagStack

protected java.util.Stack cameraMagStack

cameraMagnification

protected float cameraMagnification

accurateSpacing

protected boolean accurateSpacing
accurateSpacing causes strings to be rendered one character at a time: slower, but characters are positioned more accurately in a line.

greekText

protected boolean greekText
greekText specifies that text should be rendered as "greek" rather than actual characters
Constructor Detail

ZRenderContext

public ZRenderContext(java.awt.Graphics2D aG2,
                      ZArea aVisibleArea,
                      ZSurface aSurface,
                      int qualityRequested)
Constructs a new ZRenderContext.
Method Detail

getGraphics2D

public java.awt.Graphics2D getGraphics2D()

setVisibleArea

public void setVisibleArea(ZArea area)

getVisibleArea

public ZArea getVisibleArea()

getSurface

public ZSurface getSurface()

setAccurateSpacing

public void setAccurateSpacing(boolean b)
Specify if strings should be rendered one character at a time with slower, but more accurate spacing.
Parameters:
b - True turns on accurate spacing, false turns it off.

getAccurateSpacing

public boolean getAccurateSpacing()
Determine if strings should be rendered with accurate (but slower) character spacing.
Returns:
true if accurate spacing is on

setGreekText

public void setGreekText(boolean b)
Specify if strings should be rendered as "greek" blobs rather than actual text. Typically only very small text should be rendered "greeked" and only when the system is animating.
Parameters:
b - True turns on greek text.

getGreekText

public boolean getGreekText()
Determine if text should be rendered "greeked"
Returns:
true if text is "greeked"

setRenderingHints

protected void setRenderingHints(java.awt.Graphics2D g2,
                                 int quality)
Sets the rendering hints of the specified graphics to either or high or low. This gets called whenever the surface is painted, and specifies how high and low quality are defined.

getRenderingCamera

public ZCamera getRenderingCamera()

getRenderingTransform

public java.awt.geom.AffineTransform getRenderingTransform()

pushCamera

public void pushCamera(ZCamera camera)

popCamera

public void popCamera()

getCameraMagnification

public float getCameraMagnification()
Returns the magnification of the current camera being rendered within. If currently being rendered within nested cameras, then this returns only the magnification of the current camera. Note that this does not include the transformations of the current or any other object being rendered.
See Also:
getCompositeMagnification()

getCompositeMagnification

public float getCompositeMagnification()
Returns the total current magnification that is currently being used for rendering. This includes the magnifcation of the current cameras as well as the scale of the current any parent objects.
See Also:
getCameraMagnification()