Пример #1
0
  public void beginExecution() {
    if (cam == null) {

      int numBuffers = 2;

      env = GraphicsEnvironment.getLocalGraphicsEnvironment();
      device = env.getDefaultScreenDevice();
      // MultiBufferTest test = new MultiBufferTest(numBuffers, device);

      try {

        GraphicsConfiguration gc = device.getDefaultConfiguration();
        mainFrame = new Frame(gc);
        mainFrame.setUndecorated(true);
        mainFrame.setIgnoreRepaint(true);
        device.setFullScreenWindow(mainFrame);
        if (device.isDisplayChangeSupported()) {
          chooseBestDisplayMode(device);
        }
        mainFrame.createBufferStrategy(numBuffers);
        bufferStrategy = mainFrame.getBufferStrategy();

      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
Пример #2
0
  public void doit() throws Exception {

    Image image = (Image) this.pullInput(0);
    Rectangle bounds = mainFrame.getBounds();
    Graphics g = bufferStrategy.getDrawGraphics();
    if (!bufferStrategy.contentsLost()) {
      g.drawImage(image, 0, 0, null);
      // g.drawImage(image, 0, 0, bounds.width, bounds.height, null);
      // g.fillRect(0, 0, bounds.width, bounds.height);
      bufferStrategy.show();
      g.dispose();
    }
  }