Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 private void paintChild(Graphics2D graphics, Panel child) {
   if (panelIsInClip(child)) {
     Graphics2D childGraphics =
         (Graphics2D)
             graphics.create(child.getX(), child.getY(), child.getWidth(), child.getHeight());
     paint(child, childGraphics);
     childGraphics.dispose();
   }
 }
Ejemplo n.º 3
0
  public void paint(Panel panel) {
    Box panelBounds = panel.getAbsoluteBounds();
    int x = panelBounds.x - clip.x;
    int y = panelBounds.y - clip.y;

    Graphics2D graphics =
        (Graphics2D) rootGraphics.create(x, y, panel.getWidth(), panel.getHeight());
    paint(panel, graphics);
    graphics.dispose();
    rootGraphics.dispose();
  }
Ejemplo n.º 4
0
 public boolean shouldBuildBufferFor(Panel panel, BufferedImage buffer) {
   return buffer == null
       || panel.getWidth() != buffer.getWidth()
       || panel.getHeight() != buffer.getHeight();
 }