コード例 #1
0
ファイル: PaintJob.java プロジェクト: hbdev012/limelight
 public BufferedImage buildBufferFor(Panel panel) {
   Dimension dimension = new Dimension(panel.getWidth(), panel.getHeight());
   BufferedImage buffer = bufferedImagePool.acquire(dimension);
   Graphics2D graphics = buffer.createGraphics();
   graphics.setBackground(Colors.TRANSPARENT);
   graphics.clearRect(0, 0, panel.getWidth(), panel.getHeight());
   panel.paintOn(graphics);
   graphics.dispose();
   bufferCache.cache(panel, buffer);
   return buffer;
 }
コード例 #2
0
ファイル: PaintJob.java プロジェクト: hbdev012/limelight
 public void paintClipFor(Panel panel, Graphics2D graphics) {
   if (panel.canBeBuffered()) {
     BufferedImage panelBuffer = bufferCache.retrieve(panel);
     if (shouldBuildBufferFor(panel, panelBuffer)) {
       bufferedImagePool.recycle(panelBuffer);
       panelBuffer = buildBufferFor(panel);
     }
     graphics.drawImage(panelBuffer, 0, 0, null);
   } else {
     panel.paintOn(graphics);
   }
 }