|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.umd.cs.jazz.scenegraph.ZSurface
ZSurface represents the surface on which a camera can project. A surface can be mapped to a Java Component (AWT or Swing), a back buffer or image, or a printer - actually, anything that can generate a Graphics2D - the Java2D render context. The surface is primarily responsible for performing region management. It manages the "dirty" areas of the scenegraph that have to be repainted.
ZNode| Field Summary | |
protected ZCamera |
camera
|
protected javax.swing.JComponent |
component
|
protected ZArea |
damagedArea
|
static int |
DEFAULT_HALO
|
protected boolean |
interacting
|
protected int |
nonInteractingRenderQuality
|
static int |
RENDER_QUALITY_HIGH
|
static int |
RENDER_QUALITY_LOW
|
protected int |
renderQuality
|
protected boolean |
repaintRequest
|
| Constructor Summary | |
ZSurface()
Constructs a new Surface. |
|
ZSurface(ZCamera camera)
Constructs a new Surface. |
|
ZSurface(ZCamera camera,
javax.swing.JComponent aComponent)
Constructs a new Surface. |
|
| Method Summary | |
void |
damage(ZBounds bounds)
Notifies this surface that the specified bounds have changed, and that portion of the surface should be repainted at the next restore. |
void |
endInteraction()
Applications should call endInteraction when the user finishes a graphical interaction. |
ZCamera |
getCamera()
Get the camera this surface is associated with. |
boolean |
isInteracting()
Determine if the user interacting with the surface |
void |
paint(java.awt.Graphics g)
Paints the camera this surface sees. |
ZNode |
pick(int x,
int y)
Returns the first object intersecting the specified rectangle within DEFAULT_HALO pixels as searched in reverse (front-to-back) order, or null if no objects satisfy criteria. |
ZNode |
pick(int x,
int y,
int halo)
Returns the first object intersecting the specified rectangle within halo pixels as searched in reverse (front-to-back) order, or null if no objects satisfy criteria. |
int |
print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
Prints the surface into the specified Graphics context in the specified format. |
void |
printSurface()
Constructs a new PrinterJob, allows the user to select which printer to print to, and prints the surface. |
void |
repaint()
A utility function to repaint the entire component. |
void |
restore()
This queues a request to restore (i.e. |
void |
restore(boolean restoreImmediately)
This causes a restore (i.e. |
void |
setCamera(ZCamera cam)
Sets the component (i.e., window) that this camera is rendered within. |
void |
setComponent(javax.swing.JComponent aComponent)
Set the component that this surface is attached to, or null if none. |
void |
setInteracting(boolean v)
Specifies that the user is interacting with the surface. |
protected void |
setRenderingHints(java.awt.Graphics2D g2,
int quality)
Sets the rendering hints of the specified graphics to either or high or low. |
void |
setRenderQuality(int qualityRequested)
Specify that future rendering should occur at the specified quality. |
void |
startInteraction()
Applications should call startInteraction when the user is starting a graphical
interaction, so Jazz can properly monitor rendering speed. |
java.lang.String |
toString()
Generate a string that represents this object for debugging. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int RENDER_QUALITY_LOW
public static final int RENDER_QUALITY_HIGH
public static final int DEFAULT_HALO
protected transient ZArea damagedArea
protected boolean repaintRequest
protected int renderQuality
protected int nonInteractingRenderQuality
protected transient ZCamera camera
protected boolean interacting
protected javax.swing.JComponent component
| Constructor Detail |
public ZSurface()
public ZSurface(ZCamera camera)
setComponent(javax.swing.JComponent)node - The part of the scenegraph this camera sees.
public ZSurface(ZCamera camera,
javax.swing.JComponent aComponent)
node - The part of the scenegraph this camera sees.aComponent - The component this surface is connected to| Method Detail |
public void setComponent(javax.swing.JComponent aComponent)
aComponent - The component this surface is attached to, or null if none.public void setCamera(ZCamera cam)
public ZCamera getCamera()
public void startInteraction()
startInteraction when the user is starting a graphical
interaction, so Jazz can properly monitor rendering speed. If the system slows
down during an interaction, rendering quality may be reduced to try and improve speed.
Note that it is necessary for the application to notify the system when interaction is occurring.
If Jazz tried to balance load completely on its own, it might decide that an interaction had
finished and that it was ok to re-render in full high-quality while the user was still interacting
in which case the user may well have to wait for the render to reach a point where it could
be interrupted.endInteraction()public void endInteraction()
endInteraction when the user finishes a graphical interaction.
This is necessary as Jazz may have rendered some things at low quality in which case they
will have to be re-rendered at full quality.startInteraction()public boolean isInteracting()
public void setInteracting(boolean v)
v - Value to assign to interacting.public void setRenderQuality(int qualityRequested)
qualityRequested - Can be RENDER_QUALITY_LOW or
RENDER_QUALITY_HIGH.
protected void setRenderingHints(java.awt.Graphics2D g2,
int quality)
public java.lang.String toString()
public void damage(ZBounds bounds)
bounds - The bounds that need to be redrawn (in global coordinates).public void repaint()
public void restore()
damage(ZBounds)public void restore(boolean restoreImmediately)
restoreImmediately - True to specify that the restoration happens immediately, or false to queue a request.damage(ZBounds)public void paint(java.awt.Graphics g)
renderContext - The graphics context to use for rendering.
public ZNode pick(int x,
int y)
x - X-coord of pick point in window coordinates.y - Y-coord of pick point in window coordinates.
public ZNode pick(int x,
int y,
int halo)
x - X-coord of pick point in window coordinates.y - Y-coord of pick point in window coordinates.halo - The amount the point can miss an object and still pick itpublic void printSurface()
public int print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
graphics - the context into which the page is drawnpageFormat - the size and orientation of the page being drawnpageIndex - the zero based index of the page to be drawn
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||