152 用双缓冲消除闪烁 - I
|

|
- 在这里你有两个 "图像上下文" (applet 大小的帧缓冲), 你在第二个帧缓冲中"不在线地"构造动画所需要的下一幅图像.
- 这个帧缓冲然后被直接拷贝到主 applet Graphics 对象中, 而不是象缺省的update()
那样先清理图像
- 在 init() 中, 你应该创建帧缓冲:
- Image OffscreenImage; // Place to hold Image
- Graphics offscreenGraphics; /* The second graphics context of offscreenImage
*/
- offscreenImage = createImage(width,height);
- offscreenGraphics = offscreenImage.getGraphics();
Copyright: NPACT |

|