|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hdcookbook.grin.animator.DrawRecord
public class DrawRecord
This class represents a record of drawing to a rectangular area. It helps in the calculation of an optimized erase/redraw set for a frame of animation, by allowing a convenient means to tracking what was drawn in the previous frame, and what is to be drawn in the current frame.
The animation framework attempts to minimize the area drawn to in each frame. One way it does this is by collecting all of the drawing operations that target an area of the screen into a single bounding rectangle for the screen draw, and a (possibly smaller) area that needs to be erased. DrawRecord represents one set of drawing operations contained within a rectangular area, and it remembers what was drawn in the previous frame, so that the previous frame will be automatically erased.
The drawing framework combines all of the DrawRecord drawing operations that target the same "render area target" into a single bounding rectangle.
RenderContext
,
AnimationClient.addDisplayAreas(RenderContext)
Constructor Summary | |
---|---|
DrawRecord()
Create a new, empty DrawRecord |
Method Summary | |
---|---|
void |
addClip(int x,
int y,
int width,
int height)
Applies a clip to the area to be drawn. |
void |
applyTranslation(int dx,
int dy)
Indicates that the area is subject to the given translation. |
void |
setArea(int x,
int y,
int width,
int height)
Set the area to be drawn to in this frame of animation. |
void |
setChanged()
Flags that the contents of the area being drawn to has changed since the last frame. |
void |
setSemiTransparent()
Flags that some of the pixels in the area to be drawn might be transparent or semi-transparent, either because they're not drawn to, or because they're drawn to in SrcOver mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DrawRecord()
Method Detail |
---|
public void setArea(int x, int y, int width, int height)
As with AWT, the pixels to be filled include the pixel at x,y, but not the pixel at x+width, y+height. If the width or height are negative, then x and y are adjusted by the negative value, and the dimension is negated. These rules make this method work like Graphics.drawImage taking a source and a dest rectangle.
x
- x coordinate of upper left hand corner of drawingy
- y coordinate of upper left hand corner of drawingwidth
- width of drawing, may be negativeheight
- height of drawing, may be negativepublic void setSemiTransparent()
public void setChanged()
public void applyTranslation(int dx, int dy)
dx
- Change in x coordinatedy
- Change in y coordinatepublic void addClip(int x, int y, int width, int height)
x
- x coordinate of the clipy
- y coordinate of the clipwidth
- width coordinate of the clipheight
- height coordinate of the clip
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |