|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.PNode
edu.umd.cs.piccolox.nodes.PNodeCache
public class PNodeCache
PNodeCache caches a visual representation of it's children into an image and uses this cached image for painting instead of painting it's children directly. This is intended to be used in two ways.
First it can be used as a simple optimization technique. If a node has many descendents it may be faster to paint the cached image representation instead of painting each node.
Second PNodeCache provides a place where "image" effects such as blurring and drop shadows can be added to the Piccolo scene graph. This can be done by overriding the method createImageCache and returing an image with the desired effect applied.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode |
---|
PNode.PSceneGraphDelegate |
Field Summary |
---|
Fields inherited from interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
---|---|
PNodeCache()
|
Method Summary | |
---|---|
Image |
createImageCache(Dimension2D cacheOffsetRef)
Override this method to customize the image cache creation process. |
void |
fullPaint(PPaintContext paintContext)
Repaints this node, using the cached result if possible. |
Image |
getImageCache()
Returns an image that is a cached representation of its children. |
void |
invalidateCache()
Clears the cache, forcing it to be recalculated on the next call to getImageCache. |
void |
invalidatePaint()
Intercepts the normal invalidatePaint mechanism so that the node will not be repainted unless it's cache has been invalidated. |
protected boolean |
pickAfterChildren(PPickPath pickPath)
By always returning false, makes the PNodeCache instance NOT pickable. |
void |
repaintFrom(PBounds localBounds,
PNode childOrThis)
Handles a repaint event issued from a node in this node's tree. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PNodeCache()
Method Detail |
---|
public Image createImageCache(Dimension2D cacheOffsetRef)
cacheOffsetRef
- output parameter that can be changed to make the
cached offset line up with the node's children
public Image getImageCache()
public void invalidateCache()
public void invalidatePaint()
invalidatePaint
in class PNode
public void repaintFrom(PBounds localBounds, PNode childOrThis)
repaintFrom
in class PNode
localBounds
- local bounds of this node that need repaintingchildOrThis
- the node that emitted the repaint notificationpublic void fullPaint(PPaintContext paintContext)
fullPaint
in class PNode
paintContext
- context in which painting should occurprotected boolean pickAfterChildren(PPickPath pickPath)
pickAfterChildren
in class PNode
pickPath
- path which this node is being tested for inclusion
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |