java.awt.image.BufferStrategy.contentsLost()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中java.awt.image.BufferStrategy.contentsLost()方法的一些代码示例,展示了BufferStrategy.contentsLost()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferStrategy.contentsLost()方法的具体详情如下:
包路径:java.awt.image.BufferStrategy
类名称:BufferStrategy
方法名:contentsLost

BufferStrategy.contentsLost介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

strategy.show();
  } while (strategy.contentsRestored());
} while (strategy.contentsLost());

代码示例来源:origin: stackoverflow.com

strategy.show();
Toolkit.getDefaultToolkit().sync();
return (!strategy.contentsLost());

代码示例来源:origin: stackoverflow.com

if(strategy.contentsLost())
  break;

代码示例来源:origin: stackoverflow.com

} while (strategy.contentsLost());

代码示例来源:origin: stackoverflow.com

} while (bs.contentsLost());
Toolkit.getDefaultToolkit().sync();

代码示例来源:origin: stackoverflow.com

} while (strategy.contentsLost());

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

while (buffer.contentsLost());

代码示例来源:origin: stackoverflow.com

} while (strategy.contentsLost());

代码示例来源:origin: stackoverflow.com

} while (bs.contentsLost());
System.out.println("done");
try {

代码示例来源:origin: org.processing/core

synchronized protected void render() {
  if (canvas.isDisplayable() &&
    graphics.image != null) {
   if (canvas.getBufferStrategy() == null) {
    canvas.createBufferStrategy(2);
   }
   BufferStrategy strategy = canvas.getBufferStrategy();
   if (strategy != null) {
    // Render single frame
//        try {
    do {
     // The following loop ensures that the contents of the drawing buffer
     // are consistent in case the underlying surface was recreated
     do {
      Graphics2D draw = (Graphics2D) strategy.getDrawGraphics();
      // draw to width/height, since this may be a 2x image
      draw.drawImage(graphics.image, 0, 0, sketchWidth, sketchHeight, null);
      draw.dispose();
     } while (strategy.contentsRestored());

     // Display the buffer
     strategy.show();

     // Repeat the rendering if the drawing buffer was lost
    } while (strategy.contentsLost());
   }
  }
 }

代码示例来源:origin: stackoverflow.com

} while (strategy.contentsRestored());
  strategy.show();
} while (strategy.contentsLost());

代码示例来源:origin: org.bytedeco/javacv

@Override public void paint(Graphics g) {
    // Calling BufferStrategy.show() here sometimes throws
    // NullPointerException or IllegalStateException,
    // but otherwise seems to work fine.
    try {
      if (canvas.getWidth() <= 0 || canvas.getHeight() <= 0) {
        return;
      }
      BufferStrategy strategy = canvas.getBufferStrategy();
      do {
        do {
          g = strategy.getDrawGraphics();
          if (color != null) {
            g.setColor(color);
            g.fillRect(0, 0, getWidth(), getHeight());
          }
          if (image != null) {
            g.drawImage(image, 0, 0, getWidth(), getHeight(), null);
          }
          if (buffer != null) {
            g.drawImage(buffer, 0, 0, getWidth(), getHeight(), null);
          }
          g.dispose();
        } while (strategy.contentsRestored());
        strategy.show();
      } while (strategy.contentsLost());
    } catch (NullPointerException e) {
    } catch (IllegalStateException e) { }
  }
};

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-desktop

strategy.show();
  } while (strategy.contentsRestored());
} while (strategy.contentsLost());

代码示例来源:origin: robo-code/robocode

private void update(ITurnSnapshot snapshot) {
  if (!initialized) {
    initialize();
  }
  if (windowManager.isIconified() || !isDisplayable() || (getWidth() <= 0) || (getHeight() <= 0)) {
    return;
  }
  if (bufferStrategy != null) {
    try {
      Graphics2D g2 = (Graphics2D) bufferStrategy.getDrawGraphics();
      if (g2 != null) {
        do {
          try {
            g2.setRenderingHints(renderingHints);

            drawBattle(g2, snapshot);
          } finally {
            g2.dispose();
          }
          bufferStrategy.show();
        } while (bufferStrategy.contentsLost());

        Toolkit.getDefaultToolkit().sync(); // Update like... now!
      }
    } catch (NullPointerException e) {}
  }
}

代码示例来源:origin: gurkenlabs/litiengine

} while (this.currentBufferStrategy.contentsLost());

代码示例来源:origin: klamonte/jexer

/**
 * Push the logical screen to the physical device.
 */
@Override
public void flushPhysical() {
  // See if it is time to flip the blink time.
  long nowTime = System.currentTimeMillis();
  if (nowTime >= blinkMillis + lastBlinkTime) {
    lastBlinkTime = nowTime;
    cursorBlinkVisible = !cursorBlinkVisible;
    // System.err.println("New lastBlinkTime: " + lastBlinkTime);
  }
  if ((swing.getFrame() != null)
    && (swing.getBufferStrategy() != null)
  ) {
    do {
      do {
        drawToSwing();
      } while (swing.getBufferStrategy().contentsRestored());
      swing.getBufferStrategy().show();
      Toolkit.getDefaultToolkit().sync();
    } while (swing.getBufferStrategy().contentsLost());
  } else {
    // Non-triple-buffered, call drawToSwing() once
    drawToSwing();
  }
}

代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit

while (strategy.contentsLost());

代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit

while (strategy.contentsLost());

代码示例来源:origin: com.threerings/nenya

"lost", _bufstrat.contentsLost(), "rest", _bufstrat.contentsRestored());
      _root.getRootPane().revalidate();
      _root.getRootPane().repaint();
} while (_bufstrat.contentsLost());

代码示例来源:origin: threerings/nenya

"lost", _bufstrat.contentsLost(), "rest", _bufstrat.contentsRestored());
      _root.getRootPane().revalidate();
      _root.getRootPane().repaint();
} while (_bufstrat.contentsLost());

相关文章