|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hdcookbook.grin.animator.RenderContext
public abstract class RenderContext
This class represents a context for tracking the updates that will be needed to render the next frame of animation. It tracks areas that will need to be displayed, and areas that will need to be erased and then displayed. The animation framework collapses these areas into an optimized set.
Internally, two sets of "render area" targets are maintained, one set for erasing, and one set for drawing. Each target computes its bounding rectangle. Before erasing and before painting, the animation framework attempts to collapse these targets.
Constructor Summary | |
---|---|
RenderContext()
|
Method Summary | |
---|---|
abstract void |
addArea(DrawRecord r)
Add the given area to this render area, so that the animation manager knows about it. |
abstract void |
guaranteeAreaFilled(DrawRecord r)
Guarantee that the given area will have all of its pixels filled (e.g. |
abstract int |
setTarget(int newTarget)
Set the render area target for this context to direct its calls for adding areas. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RenderContext()
Method Detail |
---|
public abstract void addArea(DrawRecord r)
A given DrawRecord instance can't be added to a RenderContext more than once.
public abstract void guaranteeAreaFilled(DrawRecord r)
If the fill-guarantee area doesn't result in the rectangular bounds of the erase area being reduced, it probably won't help. At least in the first implementation, only removal of a complete slice of the bounding rectangle of a RenderArea is effective.
It's OK to call this method for an area that hasn't changed since the last frame of drawing. The area in question will only be drawn to if requested by a call to one of the other methods.
A given DrawRecord instance can't be added to a RenderContext more than once. It also can't be used for both addArea() and guaranteeAreaFilled().
public abstract int setTarget(int newTarget)
A typical scene should usually have a small number of targets, like between one and maybe four. See the discussion in AnimationClient.addDisplayAreas(RenderContext) for a more in-depth discussion of this.
newTarget
- The draw target number, obtained from mapDrawTargets
AnimationClient.addDisplayAreas(RenderContext)
,
AnimationClient.mapDrawTargets(java.util.Hashtable)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |