首页 > 其他 > 详细

双缓存

时间:2014-11-05 22:56:33      阅读:300      评论:0      收藏:0      [点我收藏+]
1 private Image offImage = new BufferedImage(800, 700, BufferedImage.TYPE_INT_RGB);//在内存中new一张图片出来
 1 public void paint(Graphics g) {
 2         Graphics offG = offImage.getGraphics();//得到内存图片的画笔
 3         super.paint(offG);
 4         for (Shape shape : shapes) {
 5             if (shape != null) {
 6                 shape.draw(offG);//把图形画到内存图片上
 7             }
 8         }
 9         g.drawImage(offImage,0,0, null);//把内存中的图片画到屏幕上
10     }

 

双缓存

原文:http://www.cnblogs.com/f644135318/p/4077365.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!