Jazz API Documentation

edu.umd.cs.jazz.util
Class ZRenderContext

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

public class ZRenderContext
extends java.lang.Object

ZRenderContext stores information relevant to the current render as it occurs. The render context is available to objects when they are rendered, and the objects can use this information to change the way they render themselves.

See Also:
ZCamera

Constructor Summary
ZRenderContext(java.awt.Graphics2D aG2, ZBounds visibleBounds, ZDrawingSurface 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.
 java.awt.geom.AffineTransform getCameraTransform()
          Get the transform the current camera was given before it started rendering itself.
 float getCompositeMagnification()
          Returns the total current magnification that is currently being used for rendering.
 ZDrawingSurface getDrawingSurface()
          Get the drawing surface being rendered ont.
 java.awt.Graphics2D getGraphics2D()
          Get the graphics used for this render.
 boolean getGreekText()
          Determine if text should be rendered "greeked"
 ZCamera getRenderingCamera()
          Get the current camera being rendered within.
 ZBounds getVisibleBounds()
          Get the visible bounds of the current render in the local coordinate system.
 void popCamera()
          Remove a rendering camera
 void popVisibleBounds()
          Remove a visible bounds from the render context.
 void pushCamera(ZCamera camera)
          Add a rendering camera
 void pushVisibleBounds(ZBounds bounds)
          Add a visible bounds to the render context.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZRenderContext

public ZRenderContext(java.awt.Graphics2D aG2,
                      ZBounds visibleBounds,
                      ZDrawingSurface aSurface,
                      int qualityRequested)
Constructs a new ZRenderContext.
Parameters:
aG2 - The graphics for this render
visibleBounds - The bounds being rendered in screen coordinates
aSurface - The surface being rendered onto
qualityRequested - The quality to render with
Method Detail

getGraphics2D

public java.awt.Graphics2D getGraphics2D()
Get the graphics used for this render.
Returns:
the graphics

pushVisibleBounds

public void pushVisibleBounds(ZBounds bounds)
Add a visible bounds to the render context.
Parameters:
bounds - the new bounds.

popVisibleBounds

public void popVisibleBounds()
Remove a visible bounds from the render context.

getVisibleBounds

public ZBounds getVisibleBounds()
Get the visible bounds of the current render in the local coordinate system.
Returns:
the bounds

getDrawingSurface

public ZDrawingSurface getDrawingSurface()
Get the drawing surface being rendered ont.
Returns:
the surface

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()
Get the current camera being rendered within.
Returns:
the camera

getCameraTransform

public java.awt.geom.AffineTransform getCameraTransform()
Get the transform the current camera was given before it started rendering itself. This could be useful for an advanced object type that needs to know what the transform was before the current camera changed it to apply its view.
Returns:
the transform

pushCamera

public void pushCamera(ZCamera camera)
Add a rendering camera
Parameters:
camera - The camera

popCamera

public void popCamera()
Remove a rendering camera

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()

Jazz API Documentation